The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
34 views

Why does chroot get ENOENT on an existing file?

;TL-DR - Answer: because the dynamic linker ld-linux-x86-64.so.2 was missing. I have mounted a squashfs (shouldn't matter) filesystem -ro,loop at /mnt/foo. It contains among other things the ...
1
vote
2answers
45 views

Using exec and tee to redirect logs to stdout and a log file in the same time [duplicate]

In a bash script, how can I redirect all standard outputs to a log file and tee the output on the screen using exec ? log_file="$HOME/logs/install.txt-`date +'%Y-%m-%d_%H-%M-%S'`" [ -f "$log_file" ] ...
3
votes
1answer
17 views

How to execute as the logged-in user in a sudo script (OSX)?

Is there a way to switch contexts like that? The script in my specific case is an installer postinstall script, which requires sudo privileges only for some of the tasks and requires the logged-in ...
1
vote
0answers
22 views

Programmatically obtain LILYPOND_DATADIR for execlp() call

I wrote an application that calls lilypond by execlp()ing it. However, when my app executes this line, the following error occurs: GNU LilyPond 2.16.2 warning: not relocating, no 2.16.2/ or current/ ...
1
vote
3answers
58 views

Why use “nohup &” rather than “exec &”

I know that, nohup being a binary, it can be reached from any shell. But the exec built-in probably exists in every shell. Is there a reason to prefer one of them, to the other?
1
vote
0answers
24 views

-exec isn't being passed all the files found by find [duplicate]

There are two files called install.log and install.sh The find command will find both of these and pass them to -exec ls With the addition of an or (-o), it only passes one argument to -exec ls ...
2
votes
0answers
47 views

PHP exec and amixer

I'm trying to make php lower the dB level of amixer using exec, but it seems like php isn't able to perform the task which requires sudo-access. What should be the best way to solve this? I tried: ...
4
votes
2answers
63 views

What's the recommended way to run a service as a non-root user?

I have a simple init.d script which starts and stops a process. I call the init.d as root, but I'd like the process it controls to run as a specific user. The most common suggestion online seems to ...
3
votes
1answer
222 views

What does exec 3<&1 do?

I understand exec can do I/O Redirection on current shell level. but I only sees usage like exec 6<&0 # Link file descriptor #6 with stdin. # Saves stdin. exec 6>&1 # ...
3
votes
4answers
261 views

find -exec exit 1 \; Doesn't work neither does find -exec sh -c exit 1 \;

Using Enterprise Linux 5/6, Bash 4.x I want this type of logic: # IF temp file exists, exit because we are restarting already find /tmp/restarting_server -mmin -10 -exec exit 1 lsof -i TCP:1234 ...
0
votes
3answers
132 views

Bash in php exec in webpage don't colors for png and mp3 files on Linux

I have code like this in php: header("Content-Type: text/plain"); exec("/bin/bash -c 'ls --color=always'", $result); echo implode("\n", $result); and I've got result (escape is not visible) ...
0
votes
0answers
89 views

Gnuplot and process-substitution

I have a log file where I need to cut out two values at different positions. these are: time and dQ in my file. The main problem is the paste I think. cause the other utilities work pretty well on ...
1
vote
4answers
3k views

php shell_exec() permission on Linux Ubuntu

I'm developing a php application using Linux server. My problem is executing shell_exec() to call some exe file is not work(actually not exe, it's kind of linux executable file) echo ...
0
votes
1answer
75 views

Order a list of files, by date modified, then unzip them in that order

I have a list of zip files, that must be extracted by date modified, they contain updated images and the strange way the local mls provides them means that newer zip files container newer versions of ...
1
vote
4answers
153 views

All subprocesses are Bash (!),

I was trying to use GDB, and found that whenever it attempted to spawn the program I was debugging, Bash was spawned instead (GDB would say starting myProg..., and then Bash would appear. When I ...
1
vote
1answer
330 views

find and exec: why does this command not work?

I don't get why echo prints empty line (latest cygwin version): ~/tmp >find mydor/ -name "*php" mydor/es/c/packags.php mydor/etns/inx.php mydor/pacepors.php mydor/XAE.php ~/tmp >find mydor/ ...
0
votes
1answer
397 views

How does -exec actually work

I am confused on the -exec command. E.g. in this case: find . -type f -name "*.c" -exec cat {} \;>all_c_files.txt It seems that I get cat file1 file2 file3 ... fileN While in this case: ...
1
vote
2answers
916 views

PHP exec command has the result 0 even if an error occurs

I have this PHP code: $execout=exec('ssh root@xxx.xxx.xxx.xx "sudo /etc/init.d/smokeping reload"',$output1,$result); if($result !=0){ echo"that can't reload"; } else{ echo "successfully ...
0
votes
1answer
76 views

How to prevent find -execdir from following symlinks?

Say I have a symlink: linktob -> b If I run something like find . -type l -execdir chmod 777 {} \;, the chmod command affects the file the symlink is pointing to, i.e. ‘b’. The man page suggests ...
2
votes
1answer
94 views

exec cp failes from script, yet works when issued directly

I have a script that copies SQL backups to a windows server. Here's the line from /etc/fstab: //my.win.box/share$ /winshare cifs ...
3
votes
3answers
1k views

What after exec() in ls command. Is the parent process printing the output to the console or the child?

I have a simple doubt on execution of the command ls. As per my understanding from the research I have done on the internet, I understood the below points. When we type ls command shell interprets ...
4
votes
2answers
2k views

Copy stdout and stderr to a log file and leave them on the console within the script itself

Using bash, how do I copy stderr and stdout to a log file and also leave them displayed on the console? I would like to do this within the script itself using an exec. I tried with exec ...
0
votes
1answer
315 views

Switching to another shell without copying environment variables

From tcsh, if I try: exec /home/path/to/my/zsh it works (I enter a Zsh shell) but if I try exec -c /home/path/to/my/zsh I get: -c Command not found How do I switch to my Zsh shell and start ...
0
votes
1answer
645 views

Rename files and directories with a special characters on solaris machines

The target of the following code ( commands ) is to rename files/directories and also support files/directories with a special characters as "@" or "." etc those commands are run fine on Linux ...
2
votes
3answers
1k views

`solaris + xargs command for solaris

the command find /tmp -name 'core*' -type f -print0 | xargs -0 works fine on Linux, but xargs -0 option is not legal on Solaris what is the equivalent option ( xargs? ) for Solaris 10 second ...
7
votes
4answers
1k views

redirect and log script output

I am trying to tidy up the following snippets, design goals are to log all output from a script, and should not be a wrapper. Less lines are better. I don't care about user inputs (at this stage), ...
3
votes
3answers
824 views

Find functions, commands, and builtins [duplicate]

Possible Duplicate: Executing user defined function in a find -exec call Suppose I have the following bash code: !#/bin/bash function print_echo (){ echo "This is print_echo Function" ...
0
votes
2answers
1k views

variables in find command and more shell problem [duplicate]

Possible Duplicate: Recursive rename files and directories I wrote the following script: #!/bin/bash SAVEIFS=$IFS alias export='export' IFS=$(echo -en "\n\b") find $1 -name "*" ...