to include a piece of code in existing unix script
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"
精彩评论