Reputation: 2727
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.
Upvotes: 0
Views: 630
Reputation: 318578
Simply invoke wget
to download the new version. After successful download, move it to the current script's location and chmod +x
it.
Upvotes: 4