I’m writing a utility using Bash scripting and I’d like to include an update feature with it. The script currently follows Ruby’s gem philosophy, eg one command with multiple subcommands:
gem help
gem version
gem update
Ideally you would run:
myscript update
But I don’t know if this is possible.
What’s the best method of going about this? I know that writing to the currently running script is a Bad Idea.
Simply invoke
wgetto download the new version. After successful download, move it to the current script’s location andchmod +xit.