[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Short script which worked in Lenny but does not in Squeeze.



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

My amateur's attempt at scripting has come to grief.  The script in
question reads as follows:

#!/bin/sh
# Shell script to create a tgz file for the contents of the
# /usr/local/bin directory.
# Start by creating a variable with the current directory.
CURPWD=$PWD
# Change directory to /.
cd /
# Create a variable for the name of the tgz file.
ULB="$HOSTNAME"usrlocalbin.tgz
# Create the tgz file in the specified directory.
tar -czf /media/zd/$ULB usr/local/bin
# Return to the original directory.
#cd $CURPWD

In both Lenny and Squeeze the $HOSTNAME value is BDS; the script
consequently created in Lenny the tarball BDSusrlocalbin.tgz located
in a Zip750 disk mounted at /media/zd.  (Yes, the disk was properly
mounted.)  In Squeeze however the tarball is created but without the
$HOSTNAME added at the beginning of the file name.

What I find strange is that in Squeeze each command line in the script
run independently in succession achieves the desired result.  After
doing so running "echo $ULB" returns the assigned value.  Eliminating
the creation of $ULB and entering "$HOSTNAME"uslocalbin.tgz directly
into the tar command in the script also does not produce the desired
result.

So something must be happening to prevent the tar command from using
the $ULB variable.  Is there for example something different in
Squeeze which does not permit scripts written for Lenny to work in
Squeeze?  Comment, suggestions, anyone?

Regards, Ken Heard

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAlHwEmAACgkQlNlJzOkJmTe3+ACeMCpj4xbfwjWpGctT4VRJVogL
S/AAnAokYGJPHkcKDG0/4m5Zd5D+z04F
=vQHK
-----END PGP SIGNATURE-----


Reply to: