Can I use hexdump in a shell script?
When I use it I keep getting an error .
syntax error near unexpected token ‘hexdump’
#!/bin/bash #bash-hexdump # Quick script to check delay of the shotpoints echo " please enter the complete line name as mentioned in the RAID2 " read $line cd /argus/raid2/"$line" echo echo " Entering the directory " echo for file in /argus/raid2/"$line"/*.ffid hexdump -e "16 "%_p" "\n"" $FFID | sed -n '68,73p' > list1 done for filename in 'cat list1' do sed -n 6p | awk '{print $1}' = $wd cat list.txt | sed -n 1p | cut -c13-14 = $hh cat list.txt | sed -n 1p | cut -c15-16 = $mm cat list.txt | sed -n 2p | cut -c1-2 = $ss done while [ true ] do $FFID=`ls -1rt $1 | grep -i ffid | tail -1` echo " FFID value is : $FFID" while [ $FFID = `ls -1rt $1 | grep -i ffid | tail -1` ] do hexdump -e "16 "%_p" "\n"" $FFID | sed -n '68,73p' > list done for filename in 'cat list' do cat list.txt | sed -n 1p | cut -c13-14 = $hh1 cat list.txt | sed -n 1p | cut -c15-16 = $mm1 cat list.txt | sed -n 2p | cut -c1-2 = $ss1 done $time1 = "$hh"":""$mm"":""$ss" ; $time2 = "$hh1"":""$mm1"":""$ss1" ; $former_seconds = $(date --date= "$time1" +%s); $later_seconds = $(date --date= "$time2" +%s); $time_delay = ( "$later_seconds" - "$former_seconds" ) $wb_time = ( "$wd" * 1.33 ) if (("$wb_time" + "$time_delay")) < 12.0 then echo "please slow down" fi if [ -e EOL.ffid ] then echo "EOL.ffid detected, exiting script" exit fi done
I am not able to figure out why the hexdump code is giving me an error . Please help .
Advertisement
Answer
You are missing the do
in your for loop:
for file in /argus/raid2/"$line"/*.ffid do hexdump -e "16 "%_p" "\n"" $FFID | sed -n '68,73p' > list1 done