Web20 dec. 2024 · \ is used to tell the shell a command continues in the next line. EDIT: I think this should do what you want: #!/bin/bash do_something () { if [need to do something on $1] then do it echo "OK" else echo "NOT OK" fi } do_something "arg1" do_something "arg2" do_something "arg3" Share Improve this answer Follow edited May 11, 2013 at 12:37 Web2 Answers Sorted by: 5 Turns out, you can do this just using a while loop in bash (adapted from this answer ): while read line; do echo $line; done Where echo is your command and using $line as the output for each line, which you can adjust as-needed. Share Improve this answer Follow
How to assign a multiple line string value to a variable with ...
Web26 nov. 2015 · When the replacement string has newlines and spaces, you can use something else. We will try to insert the output of ls -l in the middle of some template file. awk 'NR==FNR {a [NR]=$0;next} /Insert index here/ {for (i=1; i <= length (a); i++) { print a [i] }} {print}' < (ls -l) text.txt WebBut in the first case in order cleanly output that variable as a parameter you assigned to curl with output having newlines, in your function echo_output () you need to quote the "$@", in this case "echo" (which in turn does only printing its positional arguments into standard output and nothing more) will split the words -> arguments … huntsville active living centre
How do I read multiple lines from STDIN into a variable?
WebTo allow "edition" on the line use -e which uses readline (so you have the bash history and all editing features) -d only takes one character. E.g. from 'END' takes 'E' and whenever the user writes an 'E' the reading stops (I guess that's not what you want...) There are a few possibilities to do this. WebI want to assign the following multiple line string value to a variable in a shell script with the the exact indentations and lines. Usage: ServiceAccountName LogFile Where: … Web13 feb. 2013 · Hi, i have shell script which compiles n number of test cases and execute them one by one. i want to create report in excel through script in which two columns namely "test id" and "release".second column have two subcolumns namely compiles and excutes. so i want first column should display test... huntsville accuweather