Note that there are some explanatory texts on larger screens.

plurals
  1. POBiased behavior of bash script
    primarykey
    data
    text
    <p>I have 8 folders namely HCIVR5,HCIVR6,HCIVR7,HCIVR8,IVR5,IVR6,IVR7,IVR8. I wrote down this code first</p> <pre><code>ls -d IVR* &gt; temporary.txt </code></pre> <p>Saved this code in a file called run. then executed it using ./run. When i tried opening the file(using cat and normal opening through click), it said "cannot access temporary.txt.</p> <p>This is my entire code </p> <pre><code>ls -d IVR* &gt; temporary.txt while read ivr_line;do echo $ivr_line;cd $ivr_line;./ivr_alarm;cd ..;done &lt; temporary.txt ls -d HCIVR* &gt; temporary.txt while read hcivr_line;do echo $hcivr_line;cd $hcivr_line;./hcivr_alarm;cd ..;done &lt; temporary.txt </code></pre> <p>Now this program works for IVR5,6,7,8. After that i get the error ./run: line 4: temporary.txt: No such file or directory even when i comment the first two lines i get the same error</p> <p>code for ivr_alarm is this</p> <pre><code>mkdir TEMP day=`date +%d-%m-%Y` read ip&lt;ip.txt read ivr_number&lt;ivr_number.txt while read line;do scp -i ivr"$ivr_number"_key -r root@$ip:${line%?} ./TEMP/ ;done &lt; files_needed.txt mv ./TEMP/.bash_history ./LOGS/.bash_history_"$day" cd TEMP for file in *;do mv $file ../LOGS/${file%.*}_"$day".${file##*.} done cd .. rmdir TEMP </code></pre> <p>code for hcivr_alarm is this </p> <pre><code>day=`date +%m-%d-%Y` read ip&lt;ip.txt read ivr_number&lt;ivr_number.txt rm alarmtest rm ./LOGS/HEALTH_CHECK_$day.log while read line;do echo "ssh -i hcivr"$ivr_number"_key root@$ip '${line%?}'&gt;&gt;./LOGS/HEALTH_CHECK_$day.log" &gt;&gt; alarmtest done &lt; commands.txt chmod 700 alarmtest ./alarmtest </code></pre> <p>and for alarmtest(for HCIVR5, key changes to hcivr6_key for HCIVR6 and so on) is this</p> <pre><code>ssh -i hcivr5_key root@172.19.66.137 'ocstatus'&gt;&gt;./LOGS/HEALTH_CHECK_04-25-2012.log ssh -i hcivr5_key root@172.19.66.137 'ocmp-bre status'&gt;&gt;./LOGS/HEALTH_CHECK_04-25-2012.log </code></pre> <p>Now this program works for IVR5,6,7,8. After that i get the error ./run: line 4: temporary.txt: No such file or directory even when i comment the first two lines i get the same error. Where am i going wrong . Because when i manually open all the HCIVR folders and run ./hcivr_alarm everything works fine</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload