I am running the script below to automatically download files from a server using lftp. It works except that when it runs I get the error message
trap: SIGINT: bad trap
If I replace SIGINT and SIGTERM with INT and TERM then it does work, but I don't know if it then achieves the same purpose. This is on Linux Debian 4.9.2-10.
#!/bin/sh
login="login"
pass="password"
host="server.server.com"
remote_dir='~/remote/dir'
local_dir="/local/dir"
base_name="$(basename "$0")"
lock_file="/tmp/$base_name.lock"
trap "rm -f $lock_file" SIGINT SIGTERM
if [ -e "$lock_file" ]
then
echo "$base_name is running already."
exit
else
touch "$lock_file"
/usr/bin/lftp -p 22 -u "$login","$pass" sftp://"$host" << EOF
set sftp:auto-confirm yes
set mirror:use-pget-n 5
mirror -c -P5 "$remote_dir" "$local_dir"
quit
EOF
rm -f "$lock_file"
trap - SIGINT SIGTERM
exit
fi