I want to be able to add numbers under data and bss section out of the size information of a file in command line
./script.sh [file name]
So far I wrote my Shell script as :
ExcPath=$1 #read file name from command line
Numberone= size $1 | $data #put data column into Numberone
Numbertwo= size $1 | $bss #put bss column into Numbertwo
sum=$(( $Numberone + $Numbertwo )) # calculate the sum of DATA and BSS
echo $sum
$data and $bss are variables that I assumed that it is how shell reads from column "data" and "bss"
output from size test:
text data bss dec hexfile name
2231 600 8 2839 b17 test
Expected output after running my script:
608
How could I achieve this in Shell Script? What did I do wrong?