Linked Questions

0 votes
1 answer
3k views

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:...
Philcinbox's user avatar
0 votes
1 answer
3k views

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/{...
nen777w's user avatar
  • 109
-1 votes
1 answer
5k views

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/...
uberrebu's user avatar
  • 4,449
1080 votes
13 answers
1.8m views

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 ----...
hasen's user avatar
  • 167k
473 votes
13 answers
613k views

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 "...
helpermethod's user avatar
  • 62.8k
114 votes
10 answers
205k views

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 ...
Quillion's user avatar
  • 6,496
26 votes
4 answers
13k views

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 ...
cknoll's user avatar
  • 2,602
2 votes
3 answers
4k views

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'...
Djidiouf's user avatar
  • 839
6 votes
1 answer
3k views

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. ...
Greg Petr's user avatar
  • 1,269
2 votes
5 answers
2k views

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 ...
Girrafish's user avatar
  • 2,502
3 votes
2 answers
3k views

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 ...
Shiva's user avatar
  • 747
1 vote
0 answers
4k views

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 ...
Adrian Torrie's user avatar
3 votes
1 answer
842 views

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:...
paratrooper's user avatar
0 votes
1 answer
933 views

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 ...
lgabryel's user avatar
  • 129
0 votes
1 answer
417 views

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 ...
JuMoGar's user avatar
  • 1,760

15 30 50 per page