sanvi srivastava
sanvi srivastava

Reputation: 95

To create a tar file inside a script

I am trying to create tar file inside a script by passing variables through some property file. Following are the commands:

cd $UNIXPATH
tar -cvf $TAR_NAME $BASEFOLDER

But when I am trying to run the script, it says:

tar: option requires an argument -- f
Try `tar --help' or `tar --usage' for more information.

When I pass real values instead of variables, the script runs fine. Can anyone help me through this issue.

Upvotes: 0

Views: 807

Answers (1)

stog
stog

Reputation: 26

probably your $BASEFOLDER variable is empty might be one of the others though.

put these 2 lines just before the tar command and try it.

echo -e "PATH = $UNIXPATH\nTAR = $TAR_NAME\nBASE = $BASEFOLDER"
exit

Upvotes: 1

Related Questions