これは入力ファイルですfile1.txt
:
premon D0000070 0x201 0x40
これがスクリプトです。
script.sh
#!/bin/bash
CommandFileName=$1
while read line # This will read a line from file1.txt
do
FileName="${line// /_}"
echo $FileName
cmviewer -- -u USUPPXY-0 -b --agent=DCHUP --buffer-size=250000 #this will hold a buffer of size 2.5MB
sleep 1
cmviewer -- -u USUPPXY-0 -m --agent=DCHUP # this will start monitoring
sleep 1
cmviewer -- -u USUPPXY-0 --up '$line' --agent=DCHUP
#this is the filtering condition // this should be replicate as a command -> cmviewer -- -u USUPPXY-0 --up 'premon D0000070 0x201 0x40' #here I suspect $line is taking \n char aswell, so the command is not giving the desire output. #am I correct $line is taking new line char ? if it is so then how to remove it.
cmviewer -- -u USUPPXY-0 -s --agent=DCHUP #this will stop monitoring
sleep 1
cmviewer -- -u USUPPXY-0 -g --agent=DCHUP --dir=/root/
# this will collect the logs in /root directory. - here I am getting “Parsing error , premon D0000070 0x201 0x40 is not valid error” # but when I execute the same command with out using script , it is working fine
#mv /root/*.BIN /root/$FileName
done < $CommandFileName
私の質問が明確であることを願っています..