#!/bin/bash err_fn() { echo $1 echo yes that\'s right, my function '$1' is $1 } echo The first command line argument '$1' was $1 echo now when you press enter the error function echo will print it\'s '$1' read var1 # this passes an argument to a function as $1 err_fn "mary had a little lamb"