@geo_c @fredx181 @MochiMoppel @esos
d-pupp wrote: Thu Jan 02, 2025 4:10 pm
@Governor
I am a bash script beginner and someone may have a better idea. However my understanding is that the script will run when clicked on in ROX, you just won't see the output because it's running in the background.
To get output when the script completes successfully I would add && echo "Script completed".
You can make the text whatever you want but you need the quotes "" if you have any spaces. This text will show if the script ran successfully even if there is no other output.
Code: Select all
find "$DIR" | sort | uniq -i --all-repeated=separate && echo "Script completed"
This is great. Very useful. Thanks!
I have forgotten most of what I knew, but when I was writing scripts many years ago, I loved documenting events for the user. I was meticulous with checking everything so the chances of error were nonexistent to minimal. For example:
Check if the temp directory exists, and is writable, check if there is enough space in the temp directory, check if external commands used in the script are present and working, etc.
A user could be running a script on a locked drive; the temp variable could be set wrong, an external program that ships with the OS could be corrupt or missing, drive could be full, etc.
I included a built-in help in most of the scripts I wrote - I thought that was cool, and it left no doubt about how to use the script, since it is very limited how descriptive a filename can be with only eight characters. I ended up changing to the %temp% directory within the scripts, running all the commands there and then changing back to the original directory before ending. I realize most people would not go through so much trouble, but I liked doing it. Most people back then just assumed everything was in order and the current directory was writable and had enough space. Sorry about the rambling.
One of the worst things for me is to run a program or script and not be able to tell if it is working or if it is stuck. Or it fails without giving a very specific reason.
Code: Select all
#!/bin/bash
DIR="$1"
if [ ! -d "$DIR" ]; then
echo "Please provide a directory as first argument"
exit
fi
echo Please wait... duplicates found will show on screen.
find "$DIR" | sort | uniq -i --all-repeated=separate && echo "Script completed"
echo
,