【发布时间】:2015-09-09 12:55:31
【问题描述】:
我正在编写一个脚本,它将执行以下操作:
- 删除特定目录
- 将加密密码设置为变量
- 在命令中使用加密密码来解密它
- 将解密后的密码设置为变量
- 在命令中使用解密后的密码启动服务
这是我目前所拥有的
#!/bin/sh
rm -rf <folder path>
VAR_1="<encrypted>"
VAR_2=""
# runs the decryption command
java -jar <path to file> -d $VAR_1
# runs service script
cd <path>
./<path to file> $VAR_2
# end of script
echo "all done"
所以文件夹删除是正确的。 crypto 命令有效,但我在将解密后的密码传递到第二个变量的语法上遇到了问题。
【问题讨论】:
标签: bash shell variables scripting