If I run a command in bash, is there any way to determine which files and directories were modified as a result of running that command?
For example, if i run:
export $MYDIR="/home/users/myuser/"
touch $MY_DIR/*
I would like to be able to list the files that were modified:
/home/users/myuser/file1
/home/users/myuser/file2
/home/users/myuser/file3
But not specifically for touch. I would like the solution to be general for any command.
Is this possible?
zshsyntax. Withbash(see tag in OP's question), you'd needfind "$MY_DIR".find ${MY_DIR}would only make sense inbashif$MY_DIRwas meant to contain a $IFS-separated list of file patterns that you intended to expand. (:-b) – Stéphane Chazelas Aug 27 '18 at 18:18