所以我有了.csh脚本generate.csh,我想从里面调用另一个.csh脚本。我试过了
./shell_gen.csh test1 test2.prt
但是它运行shell_gen.csh,但没有命令行参数。
有没有人?
谢谢
generate.csh
#!/bin/csh
./shell_gen.csh test1 test2.prtshell_gen.csh
#!/bin/csh
set source = output
############################################################
# create pbm-gifs/ directory
############################################################
set destination1 = /scratch/graphics/$1gif
echo making $destination1
if ( ! -e $destination1 ) then
mkdir $destination1
foreach file ( $source/*.pgm )
echo convert $file $destination1/$file:t:r.gif
convert $file $destination1/$file:t:r.gif
end
else
echo "$destination1/ exists"
endif发布于 2009-09-17 20:55:48
我要说的是,当位置参数变量与其他一些字符连接在一起时,您可能需要用大括号将它们括起来:
set destination1 = /scratch/graphics/${1}gif但你可能也需要一个圆点:
set destination1 = "/scratch/graphics/${1}.gif"引号和引号可以防止空格。
发布于 2009-09-25 21:40:18
$1gif不是对位置参数的引用。
你有没有按照丹尼斯的建议尝试过${1}gif?我想这应该行得通。
此外,我看不到任何地方引用$2,尽管您的generate显然发送了第二个参数。
最后,第一行可能应该是#!/bin/csh -f
最好的
-pbr
https://stackoverflow.com/questions/1441144
复制相似问题