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.
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.
What security reasons are these? A plaintext password is a plaintext password no matter how you cut it. Shoving it inside a C program does not help. Just run strings on it and bam, they have your password.
You can protect it with chmod -r, of course. But that's only protection from lower users and not any protection from anyone who needs to run the program. And you could've done that for a shell script anyway.
Since you're doing it in C, you can put newlines wherever you please with \n, effectively making a multi-line string. Also note that if you put "two" "strings" in a row, they become "twostrings", so you can organize it nicely by line and still have it one giant string.
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)
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)
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)
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)
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)
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)
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)