Bash script (untar *.tar files and then cd to the untared dir)
I wanted to do a script that would untar all the *.tar files in /home/koljat/ dir, and after untaring them would cd into the untared directory so far i have done this :
Why not create an 'untar' directory, move all the tar files into it and then run your script directing the file to cd into whatever your untar directory is.
Your script would then be:
tar -zxvf /home/koljat/*.tar
If you look at "man tar" there should be an instruction on how to make files untar into a different directory - similar to the way Winzip can do this.
you can't do that, because bash creates a new shell every time you type a new command. The shell script will change directory, but it will then quit leaving you with your original shell and the origial directory.
for your idea to work, you will need to run the script as
(a dot a space and then the name of the script)
therefore delete the line reading
|All times are GMT -5. The time now is 05:28 PM.|