[英]undefined variable error in csh script
我在csh腳本中有一個函數,在此函數中,我使用的是一個源自一個文件的變量。 但是在使用腳本時,它會為同一變量拋出未定義的錯誤。 我正在使用Linux。
我的密碼
function init_remote_commands_to_use
{
# Test if the environment variable SSH_FOR_RCOMMANDS is present in .temip_config file,
# use secured on non secured rcommand depending on the result
if [ "$SSH_FOR_RCOMMANDS" != "" ]
then
if [ "$SSH_FOR_RCOMMANDS" = "ON" ]
then
# Check if the environment variable SSH_PATH is specified in .temip_config file
if [ "$SSH_PATH" != "" ]
then
SH_RCMD=$SSH_PATH
else
SH_RCMD=$SSH_CMD
fi
# Check if a ssh-agent is already running
if [ "$SSH_AGENT_PID" = "" ]
then
#Run ssh-agent for secured RCommands
eval `ssh-agent`
ssh-add
STARTEDBYME=YES
fi
else
if [ "$SSH_FOR_RCOMMANDS" = "OFF" ]
then
SH_RCMD=$RSH_CMD
else
echo "Please set the SSH_FOR_RCOMMANDS value to ON or OFF in the .temip_config file"
exit 1
fi
fi
else
SH_RCMD=$RSH_CMD
fi
}
下面是錯誤:
function: Command not found.
{: Command not found.
SSH_FOR_RCOMMANDS: Undefined variable.
請有人提出我想念的東西嗎?
C Shell csh
沒有功能。 它確實有別名,但是這些別名更難寫和讀。 有關示例,請參見此處: https : //unix.stackexchange.com/questions/62032/error-converting-a-bash-function-to-a-csh-alias
只需切換到Bash(您現有的代碼可能已在其中運行)可能是個好主意。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.