For running the script
Command used:
bash rm-bins
It would delete all the executable files.
After running the script
Commands used:
tree
Reverted all the changes so that they are not commited and again wrote the code and then published the branch and then made the pull request.
Explanation of code:find . -type f -executable
This command starts to find in the current directory for files that are marked as executable.
exec file ;:
For each file found by the find command, the -exec option executes the file command on it.
grep "executable":
The output is then piped to grep, which then filters the lines containing "executable". This is done to identify the files that file considers to be executable.
cut -d:' :
This effectively extracts the filenames from the file command's output.
xargs rm -f:
Finally, the extracted filenames are piped to xargs, which constructs and executes rm -f commands to forcefully remove each file.
Fixes #4 Added rm-bins script
*Before running the script** Command Used
tree
For running the script Command used:
bash rm-bins
It would delete all the executable files.After running the script Commands used:
tree
Reverted all the changes so that they are not commited and again wrote the code and then published the branch and then made the pull request.
Explanation of code:
find . -type f -executable
This command starts to find in the current directory for files that are marked as executable.exec file ;
: For each file found by the find command, the -exec option executes the file command on it.grep "executable"
: The output is then piped to grep, which then filters the lines containing "executable". This is done to identify the files that file considers to be executable.cut -d
:' : This effectively extracts the filenames from the file command's output.xargs rm -f
: Finally, the extracted filenames are piped toxargs
, which constructs and executesrm -f
commands to forcefully remove each file.