我有以下脚本。这是一个简单的测试用例,其中a
是任何字符串值并且b
应该是路径。
#!/bin/bash
alias jo "\
echo "please enter values "\
read a \
read -e b \
echo "My values are $a and $b""
但是,每当我尝试执行 ./sample.sh 时,都会出现以下错误:
./sample.sh: line 3: alias: jo: not found
./sample.sh: line 3: alias: echo please: not found
./sample.sh: line 3: alias: enter: not found
./sample.sh: line 3: alias: values: not found
./sample.sh: line 3: alias: read a read -e b echo My: not found
./sample.sh: line 3: alias: values: not found
./sample.sh: line 3: alias: are: not found
./sample.sh: line 3: alias: and: not found
./sample.sh: line 3: alias: : not found
当我尝试时,source sample.sh
我得到以下信息:
a: Undefined variable.
我的目标是使其成为别名,以便我可以获取此脚本并运行别名来执行命令行。有人可以看看这个并让我知道错误是什么吗?