Linux脚本练习

#!/bin/bash

for var in "$*"; do
  echo "hello world in first for cycle"
  for var1 in *; do
    echo "hello world in second for cycle"
    for var2 in "$PWD"; do
      echo "hello world in third for cycle"
      echo "$var2"
    done
    echo "$var1"
  done
done
echo "the arguments is $var"
#!/bin/bash
touch file1
rm -f file2
echo "please input:"
read var
while [ -f file1 ]; do
  echo "this is in while cycle"
  case $var in
    1)
      echo "begin delete file1"
      rm -rf file1
      echo "file1 is deleted"
      break;;
    2)
      echo "create file2"
      touch file2
      echo "file2 is created"
      break;;
    *)
      echo "input error"
      break;;
  esac
done

猜你喜欢

转载自blog.csdn.net/weixin_53939785/article/details/129872220