following code executed in a terminal opens a text editor and displays loop.txt:
if [ -f loopy.txt ]; then
rm loopy.txt
touch loopy.txt
for i in $( seq 1 10)
do
echo $i line added >> loopy.txt
done
xdg-open loopy.txt
if I run it as a script, text editor does not open. Can anyone tell me why not?
Tks, Robert
Your script cannot run as it is. You forgot the "fi" following the "if" clause.
if [ -f loopy.txt ]; then
rm loopy.txt
touch loopy.txt
fi # <----- you forgot that
for i in $( seq 1 10)
do
echo $i line added >> loopy.txt
done
xdg-open loopy.txt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.