I have been working on a Linux programming book and came to an example on signal handling that gave me a hangup. I checked to make sure I copied it alright so I don't believe that's it. Here's the example:
Which gives me the output:Code:#!/bin/sh trap 'rm -f /temp/my_tmp_file_$$' INT echo creating file /tmp/my_temp_file_$$ date > /tmp/my_temp_file_$$ echo "Press interrupt (CTRL-C) to interrup ...." while [ -f /tmp/my_tmp_file_$$ ]; do echo File Exists sleep 1 done echo The file no longer exists [highlight]trap INT echo creating file /tmp/my_tmp_file_$$ date > /tmp/my_temp_file_$$ echo "press interrupt to interrupt ...." while [ -f /tmp/my_temp_file_$$ ]; do echo File Exists sleep 1 done echo we never get here exit 0
I'm guessing it's in the trap statement syntax. Perhaps outdated usage?Code:creating file /tmp/my_temp_file_18058 Press interrupt (CTRL-C) to interrup .... The file no longer exists trap: usage: trap [-lp] [[arg] signal_spec ...]
Thanks for any help.