unix - Basename command in shell script -
i trying run following part of application start script:
for file in $template_folder/* filename='basename $file' echo "processing $filename" if [ -f "$conf_folder/$filename" ] echo "using existing $filename" else echo "creating $filename template $file" cp $file $conf_folder fi done
but output is:
processing basename $file creating basename $file template ../conf/templates/conf-test/log4j.xml
the basename command not evaluated , printed out.
when run command prompt works fine.
bash version:
bash -version gnu bash, version 3.00.16(1)-release (sparc-sun-solaris2.10) copyright (c) 2004 free software foundation, inc.
can see doing wrong?
thanks!
since system has bash
, , script works bash
, first change line #1 of script #!/bin/sh
#!/bin/bash
.
then change line:
filename='basename $file'
to this:
filename=`basename $file`
Comments
Post a Comment