I am running the following command:
OLDIFS=$IFS
IFS=$'\n'
for i in $(find $HOME/test -maxdepth 1 -type f); do
if [ $? -eq 0 ]; then
telegram-upload --to 12345 --directories recursive --large-files split --caption '{file_name}' $i &&
rm $i
fi
done
IFS=$OLDIFS
If the telegram upload command exits with a non zero code I intend to do the following:
rm somefile && wget someurl && rerun the whole command
How do I go about doing something like this?