Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

How to Pass Arguments to a Bash Script

makereport -u jsmith -p notebooks -d 10-20-2011 -f pdf

#!/bin/bash
while getopts u:d:p:f: option
do
case "${option}"
in
u) USER=${OPTARG};;
d) DATE=${OPTARG};;
p) PRODUCT=${OPTARG};;
f) FORMAT=${OPTARG};;
esac
done
 
PREVIOUS NEXT
Tagged: #How #Pass #Arguments #Bash #Script
ADD COMMENT
Topic
Name
5+4 =