我可以在shell脚本中使用hexdump吗?

时间:2016-05-20 04:19:20

标签: linux shell sh

我可以在shell脚本中使用hexdump吗?

当我使用它时,我不断收到错误。

意外令牌附近的语法错误' 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

我无法弄清楚为什么hexdump代码会给我一个错误。请帮忙。

1 个答案:

答案 0 :(得分:4)

您错过了for循环中的do

for file in /argus/raid2/"$line"/*.ffid
do

hexdump -e "16 \"%_p\" \"\\n\"" $FFID | sed -n '68,73p' > list1 

done