I know that '>' and '>>' will redirect output to a file
However, how does one keep this output on the same line as the previous line?
'echo -n' will stop a trailing new line but for terminal redirection?
HOSTS=`cat $host_list` for line in $HOSTS do ssh -o ConnectTimeout=5s $line true >> /dev/null RESULT=$? if [ $RESULT -eq 0 ] then echo $line > succeed.txt else echo $line > fail.txt fi done
ssh: connect to host c28-0112-05.ad.mtu.edu port 22: No route to host
Sun Dec 21 03:53:42 SGT 2014 > cat test5.sh #!/bin/bash echo "Please enter value for name :" read name echo "Your name is $name." echo "Next echo will be a syntax error" ehco
Sun Dec 21 03:53:46 SGT 2014 > test5.sh 1> output.txt 2> error.txt Noob Sun Dec 21 03:54:56 SGT 2014 > cat output.txt Please enter value for name : Your name is Noob. Next echo will be a syntax error Sun Dec 21 03:55:23 SGT 2014 > cat error.txt /home/alan/scripts/test5.sh: line 8: ehco: command not found Sun Dec 21 03:55:26 SGT 2014 >
Sun Dec 21 03:59:14 SGT 2014 > test5.sh > output.txt 2>&1
test5.sh 2>&1 1>output.txt or test5.sh 2>&1>output.txt ?
#!/bin/bash path=/home/rstenger/ TESTFILE=$(<banners.txt) MYVAR=$( awk 'NR > 6 && NR < 10' "$TESTFILE" ) # echo "" echo "" echo $MYVAR # for i in {1..5}; do echo ""; done echo $TESTFILE exit
sl7jump1~#->./test1.sh awk: cmd. line:2: fatal: cannot open file `****************************************************** * 1st banner has 3 line * ****************************************************** ****************************************************** * 2nd banner has 3 line * ****************************************************** ****************************************************** * 3rd banner has 3 line * ******************************************************' for reading (File name too long) 3rd_floor_lab_ex3200s.txt banner banners.txt ban_test.sh base_configs Images lab_cyclades.sh lab_devices.v3.sh Projects savvis.lab_device_list Savvis_Lab-Domain-DNS.txt test1.sh vrf_names 3rd_floor_lab_ex3200s.txt banner banners.txt ban_test.sh base_configs Images lab_cyclades.sh lab_devices.v3.sh Projects savvis.lab_device_list Savvis_Lab-Domain-DNS.txt test1.sh vrf_names 1st banner has 3 line 3rd_floor_lab_ex3200s.txt banner banners.txt ban_test.sh base_configs Images lab_cyclades.sh lab_devices.v3.sh Projects savvis.lab_device_list Savvis_Lab-Domain-DNS.txt test1.sh vrf_names 3rd_floor_lab_ex3200s.txt banner banners.txt ban_test.sh base_configs Images lab_cyclades.sh lab_devices.v3.sh Projects savvis.lab_device_list Savvis_Lab-Domain-DNS.txt test1.sh vrf_names 3rd_floor_lab_ex3200s.txt banner banners.txt ban_test.sh base_configs Images lab_cyclades.sh lab_devices.v3.sh Projects savvis.lab_device_list Savvis_Lab-Domain-DNS.txt test1.sh vrf_names 3rd_floor_lab_ex3200s.txt banner banners.txt ban_test.sh base_configs Images lab_cyclades.sh lab_devices.v3.sh Projects savvis.lab_device_list Savvis_Lab-Domain-DNS.txt test1.sh vrf_names 2nd banner has 3 line 3rd_floor_lab_ex3200s.txt banner banners.txt ban_test.sh base_configs Images lab_cyclades.sh lab_devices.v3.sh Projects savvis.lab_device_list Savvis_Lab-Domain-DNS.txt test1.sh vrf_names 3rd_floor_lab_ex3200s.txt banner banners.txt ban_test.sh base_configs Images lab_cyclades.sh lab_devices.v3.sh Projects savvis.lab_device_list Savvis_Lab-Domain-DNS.txt test1.sh vrf_names 3rd_floor_lab_ex3200s.txt banner banners.txt ban_test.sh base_configs Images lab_cyclades.sh lab_devices.v3.sh Projects savvis.lab_device_list Savvis_Lab-Domain-DNS.txt test1.sh vrf_names 3rd_floor_lab_ex3200s.txt banner banners.txt ban_test.sh base_configs Images lab_cyclades.sh lab_devices.v3.sh Projects savvis.lab_device_list Savvis_Lab-Domain-DNS.txt test1.sh vrf_names 3rd banner has 3 line 3rd_floor_lab_ex3200s.txt banner banners.txt ban_test.sh base_configs Images lab_cyclades.sh lab_devices.v3.sh Projects savvis.lab_device_list Savvis_Lab-Domain-DNS.txt test1.sh vrf_names 3rd_floor_lab_ex3200s.txt banner banners.txt ban_test.sh base_configs Images lab_cyclades.sh lab_devices.v3.sh Projects savvis.lab_device_list Savvis_Lab-Domain-DNS.txt test1.sh vrf_names
****************************************************** * 3rd banner has 3 line * ******************************************************
IFS=$'\n' var=$(sed 's/\"http\(.*\)\/\(.*\).wav\"\,\".*/\2/g' 1797.csv) # filenames of all files var2=$(sed 's/\"http\(.*\)\/\(.*\).wav\"\,\"\(.*\)\"$/\3/g' 1797.csv) # contents of all files for j in $var; do #Here I do not know how to use $var2 done
efibootmgr -c -g -L "Debian (EFI stub)" -l '\EFI\debian\vmlinuz' -u 'root=UUID=$UUID ro quiet rootfstype=ext4 add_efi_memmap initrd=\\EFI\\debian\\initrd.img' efibootmgr -c -d /dev/sdb -L "Debian Linux" -l '\EFI\debian\vmlinuz' -u 'root=UUID=1234-ffff-789 ro quiet rootfstype=ext4 add_efi_memmap initrd=\\EFI\\debian\\initrd.img'
`tail -n 1 efiboot.Hz`