I have a shell script which looks like this (myscript.sh)
echo $squad $buildnumber $date > file2.txt
I have 4 squads. I am parsing them to myscript.sh from Jenkins pipeline
those squads are:
DOD
ABCD
UAB_MS
DCF
when script write file2.txt, then it has to replace 2 squads. other 2 should return without replacing.
I have to replace:
UAB_MS, DCF to UAB
let's assume if it parse DCF to script. then expected output would be (file2.txt)
UAB 115 2022-09-23
this is what i tried (myscript.sh)
if [ $squad == 'DCF' ]
then
newsquad= sed -i 's/DCF/UAB/g'
elif [ $squad == 'UAB_MS' ]
then
newsquad= sed -i 's/UAB_MS/UAB/g'
else
newsquad=$squad
fi
echo $newsquad $buildnumber $date > file2.txt
Can someone help me to figure out this? Thanks in advance!
Note: I am not allowed to use general purpose scripting language (JavaScript, Python etc).