[フレーム]
Last Updated: February 25, 2016
·
4.303K
· blake barrett

shell function arguments in bash/os x

I love the alias keyword in bash, but when it comes to passing in multiple arguments, you really need a function.
Arguments passed to functions are accessible via 1ドル, 2ドル, $N, ...

Lets see this in use:

function backup() {
rsync 1ドル -rvhzI --size-only --inplace --human-readable --compress --compress-level=1 2ドル ;
}

This function takes two arguments, the first is the source folder the second is the target or destination folder which get passed to the rsync command via arguments passed when calling the backup function; like so:

backup ~ /Volumes/NAS/MyUserFolderBackup/

http://blog.blakebarrett.net/2012/07/backup-command-in-osx-terminal.html

AltStyle によって変換されたページ (->オリジナル) /