Tuesday, 11 February 2020

Position parameters in linux scripts



#!/bin/bash
echo "check your employee details: "
echo " running '$0'"
echo " SAP employee id: '$1'"
echo " TCS employee id: '$2'"
echo " Contact number: '$3'"
echo " TCS cubic number: '$4'"
echo " Building : '$5'"
echo " location : '$6'"
echo " job role : '$7'"
echo " ODC: '$8'"
echo " Name: '$9'"
echo " date: '${10}'"   #from 10 th position parameter on wards 's{10}' is mandatory. 

Output

Hostname:/install # ./pp.sh CXX9350  1XX1350   8XXXXXX2 8 victor Bangalore BASIS 7 Naveen 11_02_2020
check your employee details:
 running './pp.sh'
 SAP employee id: 'CXX9350'
 TCS employee id: '1XX1350'
 Contact number: '8XXXXXX2 '
 TCS cubic number: '8'
 Building : 'victor'
 location : 'Bangalore'
 job role : 'BASIS'
 ODC: '7'
 Name: 'Naveen'
 date: '11_02_2020'


No comments:

Post a Comment