Skip to content

Please use a less potential harmful target script as an example #10

Description

@henrik-jensen

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. 😲😀

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions