Sponsored Content
Top Forums UNIX for Advanced & Expert Users Issuing a Here Document as a Single Line Command Post 302527606 by BrandonShw on Friday 3rd of June 2011 06:18:08 PM
Old 06-03-2011
Issuing a Here Document as a Single Line Command

How can I run a here document on just one line? I ask, because I need to issue it from C++ as a system() or similar command and for security reasons I don't want to write out a shell script file from the program and run it.

For example, how could I write:

passwd test <<EOF
n3wp3ss
n3wp3ss
EOF

as s single command? I've tried semicolons and they don't work for this.

Thanks in advance.

Brandon
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

single line command

i need to search for a single pattern in three different logs....what would be the best one line script???? (4 Replies)
Discussion started by: roshanjain2
4 Replies

2. UNIX for Advanced & Expert Users

Merging two command into single line

1. du -sch int* | grep "total" | awk '{print $1}' first command result is 17K 2. echo "B" Result B i want the output is 17KB (2 Replies)
Discussion started by: kingganesh04
2 Replies

3. Shell Programming and Scripting

Multi line document to single lines based on occurance of string

Hi Guys, I am new to awk and sed, i am working multiline document, i want to make make that document into SINGLE lines based on occurace of string "dwh". here's the sample of my problem.. dwh123 2563 4562 4236 1236 78956 12394 4552 dwh192 2656 46536 231326 65652 6565 23262 16625623... (5 Replies)
Discussion started by: victor369
5 Replies

4. Shell Programming and Scripting

a few single line command

i m trying to find the answers of a past year exam questions , i m sure it ll be very easy for u guys , this is not a hw assignment or somth. i just wanna be sure of right answers . write a single instruction to perform each of the following tasks: (u r allowed to use c shell, and u can use... (2 Replies)
Discussion started by: brhn
2 Replies

5. Shell Programming and Scripting

sed command to grep multiple pattern present in single line and delete that line

here is what i want to achieve.. i have a file with below contents cat fileName blah blah blah . .DROP this REJECT that . --sport 7800 -j REJECT --reject-with icmp-port-unreachable --dport 7800 -j REJECT --reject-with icmp-port-unreachable . . . more blah blah blah --dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies

6. UNIX for Dummies Questions & Answers

Time command issuing all zeroes

I am trying to issue the time command on a program so I can see execution times but it is returning all zeroes. Like this: time pdriver arg1 arg2 0.000u 0.000s 0:00.00 0.0% 0+0k 0+0io 0pf+0w "0+0k 0+0io 0pf+0w" --> The "0+0io" may change sometimes to a different number. How can I run the... (2 Replies)
Discussion started by: lamentofking
2 Replies

7. Homework & Coursework Questions

Time command issuing all zeroes (is now considered homework help)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: A common problem arising in games and simulations is to generate a random arrangements of integers from 1 to N.... (5 Replies)
Discussion started by: lamentofking
5 Replies

8. Shell Programming and Scripting

Su and run single line command

myenv.sh script sets LOG_DIR variable. I can run the script and echo the variable in a single line as: # First set LOG_DIR to some dummy 'NONE' value $ export LOG_DIR="NONE" $ echo ${LOG_DIR} NONE $ cat /tmp/bin/myenv.sh export LOG_DIR="/tmp/log" #The below command doesn't show the... (2 Replies)
Discussion started by: ysrini
2 Replies

9. UNIX for Dummies Questions & Answers

To find and display the middle line in a file using single line command.

Hi all, How can i display the middle line of a file using a single line command? (6 Replies)
Discussion started by: Lakme Pemmaiah
6 Replies

10. Shell Programming and Scripting

Remove single-line breaks only in document

Regarding copy/pasted text of copyright-free book from archive.org (link below), in attempt to expand single-line-break paragraph text (not section headings or paragraph breaks) to wider right margin, Justify or Wrap in LIbreOffice is not working, and Find/Replace the paragraph mark ($) wraps all... (2 Replies)
Discussion started by: p1ne
2 Replies
PERLDGUX(1)						 Perl Programmers Reference Guide					       PERLDGUX(1)

NAME
perldgux - Perl under DG/UX. SYNOPSIS
One can read this document in the following formats: man perldgux view perl perldgux explorer perldgux.html info perldgux to list some (not all may be available simultaneously), or it may be read as is: as README.dgux. DESCRIPTION
Perl 5.7/8.x for DG/UX ix86 R4.20MU0x BUILDING PERL ON DG
/UX Non-threaded Perl on DG/UX Just run ./Configure script from the top directory. Then give "make" to compile. Threaded Perl on DG/UX If you are using as compiler GCC-2.95.x rev(DG/UX) an easy solution for configuring perl in your DG/UX machine is to run the command: ./Configure -Dusethreads -Duseithreads -Dusedevel -des This will automatically accept all the defaults and in particular /usr/local/ as installation directory. Note that GCC-2.95.x rev(DG/UX) knows the switch -pthread which allows it to link correctly DG/UX's -lthread library. If you want to change the installation directory or have a standard DG/UX with C compiler GCC-2.7.2.x then you have no choice than to do an interactive build by issuing the command: ./Configure -Dusethreads -Duseithreads In particular with GCC-2.7.2.x accept all the defaults and *watch* out for the message: Any additional ld flags (NOT including libraries)? [ -pthread] Instead of -pthread put here -lthread. CGCC-2.7.2.x that comes with the DG/UX OS does NOT know the -pthread switch. So your build will fail if you choose the defaults. After configuration is done correctly give "make" to compile. Testing Perl on DG/UX Issuing a "make test" will run all the tests. If the test lib/ftmp-security gives you as a result something like lib/ftmp-security....File::Temp::_gettemp: Parent directory (/tmp/) is not safe (sticky bit not set when world writable?) at lib/ftmp-security.t line 100 don't panic and just set the sticky bit in your /tmp directory by doing the following as root: cd / chmod +t /tmp (=set the sticky bit to /tmp). Then rerun the tests. This time all must be OK. Installing the built perl on DG/UX Run the command "make install" AUTHOR
Takis Psarogiannakopoulos Universirty of Cambridge Centre for Mathematical Sciences Department of Pure Mathematics Wilberforce road Cam- bridge CB3 0WB , UK email <takis@XFree86.Org> SEE ALSO
perl(1). perl v5.8.0 2003-02-18 PERLDGUX(1)
All times are GMT -4. The time now is 07:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy