bash-completion-tutorial
bash-completion-tutorial copied to clipboard
Please use a less potential harmful target script as an example
Thanks for the guide, I'm really grateful. But could I suggest to you to change the dummy script to something maybe less potential harmful, for example:
if [ -z "$1" ]; then
echo "No command number passed"
exit 2
fi
exists=$(fc -l -1000 | grep ^$1 -- 2>/dev/null)
if [ -n "$exists" ]; then
echo "This would have been executing the command:"
echo fc -s -- "$1"
else
echo "Command with number $1 was not found in recent history"
exit 2
fi
Ran the history command to see what was in there and thought,- ups dothis could also work as an effective foot amputation device if entering the wrong number. 😲😀