Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

pass parameters to bash script

# Run the script with the arguments as you would for
# every other command.
# Example: ./script.sh arg1 arg2 

#!/bin/sh
echo "argument1: $1"
echo "argument2: $2"

# Output: 
# argument1: arg1
# argument2: arg2
Comment

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
Comment

PREVIOUS NEXT
Code Example
Shell :: sed replace number 
Shell :: create permanent git credentials windows 
Shell :: stop tracking git pattern 
Shell :: meteor uninstall 
Shell :: change crontab editor 
Shell :: react app deploy on github pages 
Shell :: git template fetch 
Shell :: jq starts with 
Shell :: clock skew detected github 
Shell :: how to untrack a file in git 
Shell :: add npm to $PATH ubuntu 
Shell :: Is the docker daemon running? 
Shell :: how to remove a package from arch linux 
Shell :: install and import gsap in vue 
Shell :: install docker desktop on server 2019 
Shell :: install simplejwt django 
Shell :: tempfile.temporarydirectory() 
Shell :: undo reset HEAD^ 
Shell :: start beef kali linux 
Shell :: linux samba service 
Shell :: shutdown command rhel 7 
Shell :: github ssh key 
Shell :: print in shell script 
Shell :: gitattributes 
Shell :: git login 
Shell :: redis ubuntu 
Shell :: zsh: permission denied 
Shell :: Cannot install windows-build-tools 
Shell :: apache2 connection refused ubuntu 
Shell :: intel hd 4000 ubuntu driver 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =