質問

I am new to shell scripting. Could someone help me convert this to regular ksh based script? Thanks.

T=/kk/ras/tools;U=$T/upgrader
mv $T/ra_updates $U/ra_updates.br.d712
cd $U;grep "^BR" config.alpha > config.br
./ConbaseUpgrader config.br ra_updates.br.d712 s
役に立ちましたか?

解決

There's not much to do, this is workable ksh code, but to be sure the ksh interpreter runs it, add (as the first line in the script), the ksh "shebang", i.e.

#!/bin/ksh

T=/kk/ras/tools
U="$T"/upgrader
mv "$T"/ra_updates "$U"/ra_updates.br.d712

cd "$U"
grep "^BR" config.alpha > config.br
./ConbaseUpgrader config.br ra_updates.br.d712 s

It's almost always good practice to surround variable references with dbl-quotes. I have added them here.

make sure to chmod 755 myScript.ksh as appropriate.

If this code has passed thru MS-Windows (via original creation, editor, ftp (others)), then run

  dos2unix myScript.ksh

IHTH

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top