Sponsored Content
Top Forums Shell Programming and Scripting [Solved] While read line and if statement not working Post 302851765 by whegra on Monday 9th of September 2013 03:21:39 PM
Old 09-09-2013
Both the -n and -o BatchMode=Yes did the trick, thank you very much.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

read statement not working in a function

Pls this is emergency.I have written a script which is taking input from another script. and the contents of my second script are acting as functions to my main script.Now the problem is that in one of the functions i want the script ececution to stop and start when user enters any character r... (2 Replies)
Discussion started by: sumitdua
2 Replies

2. Shell Programming and Scripting

Read statement not working in a script

I have a script consisting of certain functions whose input is a file at same location. In that file i have written the name of anothe file at same location. The third file contains a word which act as a function in the first script.Let me give an example i have a scrip file say 1.sh in which i am... (7 Replies)
Discussion started by: sumitdua
7 Replies

3. Shell Programming and Scripting

bash: read file line by line (lines have '\0') - not full line has read???

I am using the while-loop to read a file. The file has lines with null-terminated strings (words, actually.) What I have by that reading - just a first word up to '\0'! I need to have whole string up to 'new line' - (LF, 10#10, 16#A) What I am doing wrong? #make file 'grb' with... (6 Replies)
Discussion started by: alex_5161
6 Replies

4. Shell Programming and Scripting

[Solved] Read a line from one string till to another.... Unix scripting..

So i have a file which contains paths to JPG images separated by a space. I have to separate them each path to another file. So, I have to search all strings that start from /home/ and ends with .jpg or .png Then write each one to another file... Can you please help me on doing this???:cool: (11 Replies)
Discussion started by: hakermania
11 Replies

5. Shell Programming and Scripting

[Solved] Read a .gz file line by line without using gzcat

Hi all Is there a way to read and process a gzip file line by line similar to a text file without using gzcat.. while processing a text file we will usually use the logic exec<sample.txt while read line do echo $line done Is there a similar way to process the gz file in the same... (4 Replies)
Discussion started by: aikhaman
4 Replies

6. Shell Programming and Scripting

While loop read line not working

Hi, I am trying to read a file line by line inside of a while loop. This while loop is part of a here document. while read line do ssh -t $2@$remotehost <<REMOTE ls path/to/dir > $path_to_dir while read line1 do echo "LINE --- $line" done... (4 Replies)
Discussion started by: mnanavati
4 Replies

7. Shell Programming and Scripting

[Solved] Not able to read the next line from a file after doing ssh

Hi, I am trying to write a code, where it reads the jobnames from a file and checks for the logs in the server. If the log is not found in the first server, then it will ssh to the 2nd server and get the details from there. I will need to save the date in a variable. But the problem is that,... (0 Replies)
Discussion started by: ajayakunuri
0 Replies

8. Shell Programming and Scripting

Read statement not working

hello guys, i am having the below piece of code error () { echo"Press y /n" read ans case $ans in y) main;; n) exit esac } In the abve code, read statement is not working i.e not waiting for user to enter input. ,i tested exit status its 1. could anyone help me to do this ... (11 Replies)
Discussion started by: mohanalakshmi
11 Replies

9. Shell Programming and Scripting

While read -a line not working in ksh

while read -a line; this is not working in ksh. what is the equivalent of this in ksh. read: -a: unknown option (2 Replies)
Discussion started by: archana25
2 Replies

10. Shell Programming and Scripting

Bash read input in case statement not working as expected

I'm having an issue with bash read input when using a case statement. The script halts and doesn't read the input on the first loop. if I hit enter then the scripts starts to respond as expected. Need some help here. defaultans=8hrs read -e -i $defaultans -p "${bldwht}How long would you like... (5 Replies)
Discussion started by: woodson2
5 Replies
SWITCH_ROOT(8)						      System Manager's Manual						    SWITCH_ROOT(8)

NAME
switch_root - switch to another filesystem as the root of the mount tree. SYNOPSIS
switch_root [-hV] switch_root newroot init [arg...] DESCRIPTION
switch_root moves already mounted /proc, /dev and /sys to newroot and makes newroot the new root filesystem and starts init process. WARNING: switch_root removes recursively all files and directories on the current root filesystem. OPTIONS
-h, --help show help and exit -V, --version show version number and exit RETURN VALUE
switch_root returns 0 on success and 1 on failure. NOTES
switch_root will fail to function if newroot is not the root of a mount. If you want to switch root into a directory that does not meet this requirement then you can first use a bind-mounting trick to turn any directory into a mount point: mount --bind $DIR $DIR SEE ALSO
mount(8) chroot(2) init(8) mkinitrd(8) AUTHORS
Peter Jones <pjones@redhat.com> Jeremy Katz <katzj@redhat.com> Karel Zak <kzak@redhat.com> AVAILABILITY
The switch_root command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/. Linux June 2009 SWITCH_ROOT(8)
All times are GMT -4. The time now is 01:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy