Linked Questions
18 questions linked to/from Multi-line string with extra space (preserved indentation)
0 votes
1 answer
3k views
Write to variable and preserve formatting [duplicate]
ifconfigvar=$(ifconfig eth0) && echo $ifconfigvar You can see that output of the above command has no formatting: eth0 Link encap:Ethernet HWaddr 00:1f:16:ef:5b:c0 UP BROADCAST MULTICAST MTU:...
0 votes
1 answer
3k views
Bash create file script with echo command [duplicate]
I need to generate the following file content with the bash script. #!/bin/sh script_dir=$(dirname "$(realpath $0)") export LD_LIBRARY_PATH=$script_dir/lib exec $script_dir/{...
-1 votes
1 answer
5k views
cat EOF issues with indentation [duplicate]
I am not sure why it is such an hassle trying to cat content to file when the content is indented. I am trying to close this heredoc block: UserData: "Fn::Base64": !Sub | #!/bin/...
1080 votes
13 answers
1.8m views
How does "cat << EOF" work in bash?
I needed to write a script to enter multi-line input to a program (psql). After a bit of googling, I found the following syntax works: cat << EOF | psql ---params BEGIN; `pg_dump ----...
473 votes
13 answers
613k views
How to output a multiline string in Bash?
How can I output a multipline string in Bash without using multiple echo calls like so: echo "usage: up [--level <n>| -n <levels>][--help][--version]" echo echo "Report bugs to: " echo "...
114 votes
10 answers
205k views
Multi line string with arguments. How to declare?
Let's say I have an extremely long string with arguments that I want to create. I know you can create a multiline string with cmd = """line 1 line 2 line 3""" But now lets say I want to ...
26 votes
4 answers
13k views
How can I execute multiline Python code from a Bash script?
I need to extend a shell script (Bash). As I am much more familiar with Python I want to do this by writing some lines of Python code which depends on variables from the shell script. Adding an extra ...
2 votes
3 answers
4k views
Insert multiple lines and keep their indentation with sed
I have some Tython functions that I want to insert in a file. Inserting multiple lines in itself works well using a variable and some \n, but the indentation isn't kept. Because it's Python code, that'...
6 votes
1 answer
3k views
Remove starting space tabs output echo multi-lined string
I am unable to figure out how to indent parts of bash script, preserving indentation in the code. I want the output to be formatted with correctly without any tabs/spaces prefix to the output lines. ...
2 votes
5 answers
2k views
Equivalent of python's textwrap dedent in bash
I have a variable containing a multi-line string in bash: mystring="foo bar stack overflow" Obviously this gives a ton of indentation when I echo "$mystring". In python ...
3 votes
2 answers
3k views
What is the purpose of "echo exit |" in "echo exit | sqlplus user/pass@ora_instance @file.sql"?
I have never seen someone pipe 'exit' literal to command execution. This is the actual code I'm trying to understand, echo exit | sqlplus user/pass@ora_instance @file.sql I can understand the second ...
1 vote
0 answers
4k views
How to install beehive on windows, to allow remote execution of hql scripts
How do you run beeline on local machine once you've downloaded the jar files? According to this answer (for Ubuntu), you don't need to do a complete install of Hive to run the beeline CLI. You just ...
3 votes
1 answer
842 views
Why bash stops with parameter -e (set -e) when it meets read command?
Here is a simple script with parameter (set -e): #!/bin/bash set -e echo "begin" read -r -d '' var <<- EOF echo "hello" EOF echo "${var}" I expected no errors here, but the output is just:...
0 votes
1 answer
933 views
Git, clone with specific private key, sh.exe cannot find file
I make some script : #!/bin/bash ##### dest_branch="4.0.8_copy" source="sprint24_copy" ##### dest=$dest_branch source=$source_branch startDir=`pwd` sshFile=$startDir"/git_ssh.ssh" gitrepo="<some ...
0 votes
1 answer
417 views
What does OMG in a command line terminal mean? [duplicate]
I am starting with Linux bash scripting and I have found a bash script which uses: my_command << OMG ..rest_of_commands OMG What does this OMG means? I have been searching about it but I did ...