###1.编写一个shell脚本,完成功能
1)显示文字“Waiting for a while…”;
2)长格式显示当前目录下面的文件和目录,并输出定向到/home/yuegang02/file.txt文件;
3)定义一个变量,名为s,初始值“Hello”;
4)使该变量输出重定向到/home/yuegang02/string.txt
{{{密码回复可见}}}
1)显示文字“Waiting for a while…”;
2)长格式显示当前目录下面的文件和目录,并输出定向到/home/yuegang02/file.txt文件;
3)定义一个变量,名为s,初始值“Hello”;
4)使该变量输出重定向到/home/yuegang02/string.txt
{{{密码回复可见}}}
0
- #!/bin/bash
- echo "Waiting for a while…"
- /bin/ls -l > /home/yuegang02/file.txt
- s="Hello"
- echo s > /home/yuegang02/string.txt
0
#!/bin/bash
echo "Waiting for a while…"
mkdir -p /home/yuegang02/
cd /home/yuegang02/
touch file.txt
cd -
ls -l > /home/yuegang02/file.txt
s="Hello"
mkdir -p /home/yuegang02/
cd /home/yuegang02/
touch string.txt
cd -
echo $s > /home/yuegang02/string.txt
echo "Waiting for a while…"
mkdir -p /home/yuegang02/
cd /home/yuegang02/
touch file.txt
cd -
ls -l > /home/yuegang02/file.txt
s="Hello"
mkdir -p /home/yuegang02/
cd /home/yuegang02/
touch string.txt
cd -
echo $s > /home/yuegang02/string.txt
0
- #!/bin/bash
- echo "Waiting for a while..."
- ls -l >/home/yuegang02/file.txt
- s="Hello"
- echo $s>/home/yuegang02/string.txt
0
#!/bin/bash
echo "Waiting for a while..."
if [ -d /home/yueyang02 ]
then
echo `ls -l` > /home/yueyang02/file.txt
else
mkdir -p /home/yueyang02
echo `ls -l` > /home/yueyang02/file.txt
fi
s="Hello"
echo $s >> /home/yueyang02/string.txt
echo "Waiting for a while..."
if [ -d /home/yueyang02 ]
then
echo `ls -l` > /home/yueyang02/file.txt
else
mkdir -p /home/yueyang02
echo `ls -l` > /home/yueyang02/file.txt
fi
s="Hello"
echo $s >> /home/yueyang02/string.txt
编辑回复