开发者

to include a piece of code in existing unix script

开发者 https://www.devze.com 2023-02-12 02:11 出处:网络
I have a filewatcher.txt file . i want to include a piece of code in an existing unix script(final) that will ask user for input(Y/N) to check 开发者_如何学Pythonwhether the file has been renamed(*fil

I have a filewatcher.txt file . i want to include a piece of code in an existing unix script(final) that will ask user for input(Y/N) to check 开发者_如何学Pythonwhether the file has been renamed(*filewatcher.txt e.g.SAV_filewatcher.txt or xyz_filewatcher.txt ) or the original name(filewatcher.txt) exists. If the file watcher has not been renamed the existing code(final) will exit.


I'm not positive I understand what you're looking to do, but here are a few basic scripting tips:

if [ -f "filewatcher.txt" ]; then
  echo "file has not been renamed"
fi

echo "Please give me some input"
read var
echo "Your input was $var"
0

精彩评论

暂无评论...
验证码 换一张
取 消