Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/607564/ho…
How to read each line in a file separated by delimiters and spaces
I have written a small shell script to get some values from a text file and have them in a for loop to use them as a variables which I will be using as an input to a wsadmin command. Below is the s...
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/264926/is…
Is it a sane approach to "back up" the $IFS variable?
From this follows: A portable script cannot dependably inherit IFS via the environment. A script that intends to use only the default splitting behavior (or joining, in the case of "$*"), but which may run under a shell which initializes IFS from the environment, must explicitly set/unset IFS to defend itself against environmental intrusion.
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/18922/in-…
In `while IFS= read..`, why does IFS have no effect?
The outer IFS (outside the while construct) prevails in all examples shown in the script below.. What's going on here? Have I got the wrong idea of what IFS does in this situation? I expected the array-split results to be as shown in the "expected" column.
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/208911/wh…
shell script - while read loop - Unix & Linux Stack Exchange
I have a file like one below var 3 2014 string var1 4 2011 string4 var2 6 1999 string2 var3 1 2016 string6 Then i have this while read loop to compare one of the colum...
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/264795/se…
Setting a IFS for a bash script - Unix & Linux Stack Exchange
The example does not set IFS within the script, because bash disallows importing IFS from the environment, according to a comment in variables.c: /* Don't allow IFS to be imported from the environment. */ temp_var = bind_variable ("IFS", " \t\n", 0); setifs (temp_var); Built-in commands and non- script uses get the assignment to IFS, of course, but keep in mind that IFS only applies to word ...
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/775703/pi…
pipe to a different file descriptor - Unix & Linux Stack Exchange
If you mean you want the while IFS= read -ru9 line; do ...; done to loop over the output of grep rather than the contents of servers.txt, then with bash, zsh or recent versions of ksh93¹, you can use redirection from a process substitution instead of a pipeline:
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/794192/us…
Using curly braces to process colon-separated variables
¹ Though note that it splits ::a:b::c::: into a, b and c only like IFS-splitting did in the Bourne shell (but not in modern Bourne-like shells except when space, tab or newline are used as separators).
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/748418/co…
Confusing behavior when using IFS and read [duplicate]
Confusing behavior when using IFS and read [duplicate] Ask Question Asked 2 years, 5 months ago Modified 2 years, 5 months ago
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/583596/se…
Security: shell scripts to reset the IFS variable against misuse?
From my reading of O'Reilly's "Classic Shell Scripting," it looks like you want to reset the input field separator IFS to newline, space and tab at the start of every shell script to guard against potentially malicious or otherwise malformed input.
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/613224/ho…
How to output comma separated values using IFS="," in shell
I have a small script, which does not give comma separated output when IFS is used, but IFS is mandatory as i need it to read many other value. The output of the below script is odi_server1 odi_ser...