I have this legacy delete script script, It is doing some delete work on a remote application.
When processing of delete is done it will return #completed successfully# or it will return
#
*nothing more to delete*
*Program will exit*
#
I would like to assign its output and execute the delete script as long its output is "completed successfully".
I am unable to assign the results of the script to a variable. I am running the shell script from folder X while the delete script is in folder Y. Besides the script below, I also tried:
response=$(cd $path_to_del;./delete.sh ...)
I am unable to make this work.
#!/bin/bash
path_to_del=/apps/Utilities/unix/
response='completed successfully'
counter=1
while [[ $response == *successfully* ]]
do
response= working on batch number: $counter ...
echo $response
(cd $path_to_del;./delete.sh "-physicalDelete=true") > $response
echo response $response
((counter++))
done
echo deleting Done!
response= working on batch $counter ...? Then runbash -x yourscriptand post output as to what exactly isn't working? Also if you can edit the legacy script, it would make more sense to me to give the script exit codes.stderr, in which case see answer to "Bash how do you capture stderr to a variable?"