Dinesh Babu Rengasamy
Dinesh Babu Rengasamy

Reputation: 312

Unzip to a directory and run commands on the unzipped folder from shell script

I have the following commands in my shell script,

sudo mkdir targetfolder
sudo chmod 777 targetfolder
unzip srcfile.zip -d targetfolder
nohup targetfolder/path/executable &

when i run the above script it throws an error for the nohup command saying that the path with in target folder does not exist.

If I run these commands one by one from console, they work fine. Basically I think before completing the unzip next command is running.

Please help me with this issue.

Thanks.

Upvotes: 1

Views: 842

Answers (1)

Ashishkumar Singh
Ashishkumar Singh

Reputation: 3600

I guess the issue is that you are trying to run the nohup command on a path considering the newly created folder is created from root

So instead of running nohup /targetfolder/path/executable &

try running nohup targetfolder/path/executable &

I checked on my system and if there is a valid path targetfolder/path/executable, then nohup will not throw an error

Upvotes: 1

Related Questions