新人求助,shell脚本怎么执行啊?
时间:2011-10-21
来源:互联网
代码:
#! /bin/bash
opt="z"
until ["$opt"="x"];
do
echo "a. List all files in the present working directory"
echo "b. Display today's date and time, and your Linux version"
echo "c. Invoke the shell script of Problem 2"
echo "d. Display whether a file is a \"simple\" file or a \"directory\""
echo "e. Create a backup for a file"
echo "f. Start an ftp session to our course site"
echo "x. Exit"
echo "Please enter an option:"
read opt
done
echo "Bye-Bye"
opt="z"
until ["$opt"="x"];
do
echo "a. List all files in the present working directory"
echo "b. Display today's date and time, and your Linux version"
echo "c. Invoke the shell script of Problem 2"
echo "d. Display whether a file is a \"simple\" file or a \"directory\""
echo "e. Create a backup for a file"
echo "f. Start an ftp session to our course site"
echo "x. Exit"
echo "Please enter an option:"
read opt
done
echo "Bye-Bye"
就想做一个选项选择,运行的时候提示如下
代码:
./work1: 行 4: [z=x]: 未找到命令
a. List all files in the present working directory
b. Display today's date and time, and your Linux version
c. Invoke the shell script of Problem 2
d. Display whether a file is a "simple" file or a "directory"
e. Create a backup for a file
f. Start an ftp session to our course site
x. Exit
Please enter an option:
a. List all files in the present working directory
b. Display today's date and time, and your Linux version
c. Invoke the shell script of Problem 2
d. Display whether a file is a "simple" file or a "directory"
e. Create a backup for a file
f. Start an ftp session to our course site
x. Exit
Please enter an option:
会有一个这个
代码:
./work1: 行 4: [z=x]: 未找到命令
我觉得应该是while的判断条件有错,不知道正确的格式应该怎么样
作者: Mr沛 发布时间: 2011-10-21
空格啊空格。。。。
[ 是程序名,后面四项都是它的参数。
[ 是程序名,后面四项都是它的参数。
作者: lilydjwg 发布时间: 2011-10-21
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28