我正在编写一个 csh 别名,以便可以在我的 csh 中使用以下 bash 函数:
function up( )
{
LIMIT=$1
P=$PWD
for ((i=1; i <= LIMIT; i++))
do
P=$P/..
done
cd $P
export MPWD=$P
}
(我从这里偷了上面的 bash 函数)
我写了这个:
alias up 'set LIMIT=$1; set P=$PWD; set counter = LIMIT; while[counter!=0] set counter = counter-1; P=$P/.. ; end cd $P; setenv MPWD=$P'
但是,我收到以下错误:
while[counter!=0]: No match.
P=/net/devstorage/home/rghosh/..: Command not found.
end: Too many arguments.
而且我的脚本没有按预期工作。我从这里开始阅读 csh 。
我不是 csh 专家,我上面写的是我的第一个 csh 脚本。请让我知道我做错了什么。