Showing posts with label bash. Show all posts
Showing posts with label bash. Show all posts

Friday, 12 February 2021

How to do I send parameters to bash script / shell script?

You can send parameters from command-line to a bash script using $1 $2 ...

$1 represents parameter 1

$2 represents parameter 2

likewise

For Example:

startup.sh

#!/bin/bash

echo hello $1 $2
on command line :
./startup.sh dinesh dontha
output:
hello dinesh dontha