Skip to main content

Thread: How to terminate the command in shell script


hi,

how terminate command in shell script, expecting ctrl+c terminate. example shell script is

cat /dev/input/event1 > event1.txt
cat /dev/input/event2 > event2.txt
cat /dev/input/event3 > event3.txt


not executing 2nd command, because first command waiting input of ctrl+c terminate. dont want press ctrl+c manually.
there way execute these 3 commands without manuall input.
please me out.

thanks
kemparaju

quote posted kemparaju view post
hi,

how terminate command in shell script, expecting ctrl+c terminate. example shell script is

cat /dev/input/event1 > event1.txt
cat /dev/input/event2 > event2.txt
cat /dev/input/event3 > event3.txt


not executing 2nd command, because first command waiting input of ctrl+c terminate. dont want press ctrl+c manually.
there way execute these 3 commands without manuall input.
please me out.

thanks
kemparaju
start in background, wait bit, send kill, ie:
code:
cat /dev/input/event1 > event1.txt & pid=$! sleep 1 kill $pid


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk How to terminate the command in shell script


Ubuntu

Comments

Popular posts from this blog

Joomal 3.6.3 update error - PHP temporary folder is not set - Joomla! Forum - community, help and support

Upgrade 3.4.8 to 3.5.1 failed "download package failed" - Joomla! Forum - community, help and support

Fatal error during instalation - Joomla! Forum - community, help and support