Skip to content

Latest commit

 

History

History
42 lines (28 loc) · 696 Bytes

arguments.md

File metadata and controls

42 lines (28 loc) · 696 Bytes

Using arguments in bash

If you have ever ran a script like so:

somescript.sh something

You know what arguments are, well positional arguments anyways. This is how they're used...

#!/bin/bash

#somescript.sh

name=$1
title=$2

echo "Hello $name you're a $title

You would then run the script like so:

somescript.sh Paul SeniorSolutionsEngineer

To use multiple just increase the number after the $


You can also use arguments for aliases like here:

In this case the $1 / $2 placeholders in the alias is used for command-line options, not arguments.

s3pp() {
	aws s3 $1 "s3://pp-client-onboarding/$2" --profile pp-client-onboarding
}