The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
2answers
62 views

Auto answering password for OPENSSL using HEREDOC [closed]

I have the following command but it doesn't work for me... cd /etc/postfix/ssl/ && openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024 <<PASS password password PASS The output ...
2
votes
3answers
255 views

How to login as root from Bash and do stuff

This is my simple bash: cat test.sh #!/bin/bash echo "hello" su - root -c /path/to/script.sh <<EOF password EOF whoami echo "good bye" But I get this error: ...
2
votes
1answer
58 views

< and << in UNIX /Linux

What is the option <<and < are used in linux for??? For example cat << abc.txt I know its a stupid question, but i was not able to search it on google as i did not know what ...
1
vote
1answer
110 views

Cat write text with “$” inside

I want to write configuration information to a specific file which has dollar signs ($) inside. That seems to be a problem. Here's what I did: $ cat >> /etc/nginx/nginx.conf <<EOF # For ...
1
vote
1answer
82 views

Execute command on remote host fails

I'm trying to execute some commands on remote host like this : ssh -t -t -l user 172.20.20.20 <<EOF pid=$(ps -ef | grep [a]pp-management | awk '{print $2}') && kill -9 $pid && ...
9
votes
3answers
170 views

bash: Using read <<<“$VARIABLE” on a read-only root partition

Just by coincidence I had to use my ATA-ID-to-device-name script (found here: http://serverfault.com/questions/244944/linux-ata-errors-translating-to-a-device-name/426561#426561) on a read-only / ...
2
votes
2answers
157 views

setting variables inside subshell when using <<

I am using the following method in order to pass commands into a subshell that is started by "newgrp". #!/bin/csh echo "Before newgrp" /usr/bin/newgrp users <<EONG echo "hello from within ...
4
votes
1answer
517 views

How to echo variables using cat into file?

I have simple script like this: #!/bin/bash BOO=bla-bla-bla cat > ./Makefile <<'EOF' Hello INCLUDES := -I/data/opt/include/ -Ideps/ -I$BOO/include EOF Yet it outputs into ...
6
votes
1answer
438 views

How do you use output redirection in combination with here-documents and cat?

Let's say I have a script that I want to pipe to another command or redirect to a file (piping to sh for the examples). Assume that I'm using bash. I could do it using echo: echo "touch somefile ...
-2
votes
1answer
49 views

Here document and input redirection with -

What does the following command do? In particular I don't understand the role of - in input redirection. cat <<-EOF | command $argument first option second option EOF Is it ...
3
votes
1answer
5k views

Assigning the output of a SQL query to variable

I am connecting to oracle database and firing a query and assigning the output to variable But when I echo the value of the variable it doesn't get printed correctly. count=`sqlplus -s ...
0
votes
1answer
240 views

Use sudo tee with heredoc to append to existing file

From Generate script in bash and save it to location requiring sudo we have this method, which I like: sudo tee "$OUTFILE" > /dev/null <<'EOF' foo bar EOF However, I would like to use that ...
4
votes
3answers
2k views

bash script error stty: standard input: Inappropriate ioctl for device

I'm using here-documents in a bash script to automate installation and setup where a password is required many times. I enter the password once and the script passes it to the various commands. In ...
0
votes
1answer
300 views

using bash script to output new script: need mixture of variables to be replaced and not replaced

I'm having a problem with bash variable substitution. Here's a silly example of what I am trying to do. I need to output a new script from a bash script. A line (see echo in my example) has a mixture ...
0
votes
2answers
158 views

EOF blocks my script?

I have this script (it is actually a snippet from a bigger script). #!/bin/sh if [ $actualsize -ge $MAXSIZE ]; then read dummy FILEPOINT <<EOF `dd if=myfile skip=8001 count=1 bs=1|od -x` ...
3
votes
1answer
506 views

Can't indent heredoc to match nesting's indent

If there's a "First World Problems" for scripting, this would be it. Mainly asking because I feel like I should know how to get around it if I need to. I have the following code in a script I'm ...
1
vote
1answer
259 views

what's wrong with embedding php scripts inside bash ones?

I was trying to use php inside bash script, but I came across several problems. My first try failed with error about bash not being able to find end of here-document. The minimal version that still ...
2
votes
1answer
76 views

Reading multine text inside a bash script

I have following graphviz script which I wish to convert to a bash script. #!/bin/bash graph=$(cat <<GRAPHEND graph match { node[style=filled shape=point label= ""]; ...
2
votes
1answer
768 views

Using a here-doc for `sed` and a file

The title says it all, I want to use a here-doc for sed commands and provide the file to be read and the output file. I've looked at Here-Documents from Advanced Bash Scripting guide but it does not ...
4
votes
1answer
1k views

“unexpected end of file” in bash script

I have this if in a bash script: if [ $ACTION = deploy ]; then ${JAVA_HOME}/bin/java ${JVM_ARGS} weblogic.WLST << EOJ connect('XXX','XXX','t3://XXX:8001') jndi(); ls(); ...