How can I use the shell's process substitution in Perl's system()?
Why does this line of Perl break? system("paste <\( cut -f2 $file \) $file2 > $fileout"); What's the correct way to do it? ...
Why does this line of Perl break? system("paste <\( cut -f2 $file \) $file2 > $fileout"); What's the correct way to do it? ...
I have files: hallo_flower.php hallo_house.php I need to rename them to: tjena_flower.php tjena_house.php ...
Hi, I'm well aware of the source (aka .) utility, which will take the contents from a file and execute them within the current shell. Now, I'm transforming some text into shell commands, and then running them, as follows: $ ls | sed ... | sh ls is just a random example, the original text can be anything. sed too, just an example for...
I need to kill the "yes" command after some iterations, two methods: a) kill it b) give "n" as an input after some time How would you automate the removal of .git directory? ...
I have a Unix timestamp that I need to get the individual year, month, day, hour, minute and second values from. I never was very good in math class so I was wondering if you guys could help me out a little :) I have to do everything myself (no time.h functions). The language is C. ...
Does getpwnam respect /etc/nsswitch.conf? The manpage for getpwnam states The getpwnam() function returns a pointer to a structure containing the broken-out fields of the record in the password database (e.g., the local password file /etc/passwd, NIS, and LDAP) that matches the username name. This leads me t...
If I'm in a shell script that has no shebang line… Hum, that doesn't matter, because indeed sh is always used. Maybe not so. Is there a command to identify the name/type of current shell, the path to the shell binary, and the version of the shell? I don't need all of that, but the more I can get, the better. I want something that has ...
An Apache 2.x Webserver with default configurations from the ubuntu/debian repositories will use the www-data unix account for apache2 processes handling web requests. Assuming that apache is serving two different sites (domain1.com and domain2.com), is it possible for apache to use unix user www-data1 when handling requests to domain1.c...
I have my application hosted on a shared web host which uses cpanel. The control panel has a web interface to cronjob. I want to use cronjob to execute a file at a certain time everyday. The challenge am having now is the right command to enter in the "Command to run" text box. I'll be very glad if someone can help me out with this. Tha...
I need to recursively copy a directory tree, ignoring any subdirectories named 'CVS'. Is there a simple way to do this? ...
i am a shell scripting noob. i currently have a cronjob that runs every 15mts and check to see if a file exists. If it exists, it takes the file and processes and then deletes it Now, instead of deleting it, i want to make a copy and ftp it to Server2 below is the delete script. i want to modify it so that it makes a copy of the file...
I am currently writing an application that read frames from camera, modify them, and save them into a video file. I'm planing to do it with ffmpeg. There's rarely a documentation about ffmpeg. I can't find a way. Does any know how to do it? I need it to be done on unix, and in C or C++. Does any can provide some instructions? Thanks. ...
I am looking for a way to list all the files in a directory excluding directories themselves, and the files in those sub-directories. So if I have: ./test.log ./test2.log ./directory ./directory/file2 I want a command that returns: ./test.log ./test2.log and nothing else. ...
I have a Perl script which does this: It generates a ssh authentication key on my system and then copies this key to a remote Linux system for passwordless ssh connects. The code is as below: # Generate an rsa key and store it in the given file system("ssh-keygen -t rsa -N '' -f /root/.ssh/id_rsa 1>/dev/null"); # Copy the generated ke...
What I'm looking for is something like: if [ -f "filenam*" ]; then ... fi But the wildcard (*) causes problems. I've also tried: if [ `ls filenam* > /dev/null 2>&1` ]; then ... fi Which may work in other shells but doesn't appear to work in Bourne shell (sh). Thanks for any help! EDIT: Sorry, not C shell, Bourne shell (s...
I'm looking for a way to get notified in my unix system for new email. I know gmail supports IMAP IDLE, what is the best way to make use of that feature? Any programming language is fine, as long as it is supported in linux/unix. ...
I have a cron job: $SP_s/StartDailyS1.sh >$LP_s/MirrorLogS1.txt Where SP_s is the path to the script and LP_s is the path for the log file. This sends stdout to the log file and stderr to my email. How do I?: 1) send both stdout AND stderr to the logfile, 2) AND send stderr to email or to put it another way: stderr to both the logf...
I want to launch a child process on OS X such that the child process does not inherit the current process's open files/ports. Any suggestions on how to accomplish this? Shell commands that I can invoke using the system() function would work too - I just don't know of a good shell command that enables this. Thanks! ...
Consider this scenario in which an executable A.bin uses libY.so and libZ.so. A.c, Y.c and Z.c are all written in C. Z.c and Y.c are compiled into respective .so files. This is the directory structure of the files $home/bin/A.bin $home/lib/libY.so $home/lib/libZ.so When I run A.bin as normal user, A.bin runs normally as expected. Note...
How do I find all the open files in a process (from inside itself)? This seems useful to know after a fork() (before exec()). I know of the existance of getdtablesize() and the more portable sysconf(_SC_OPEN_MAX), but it seems inefficient to attempt closing every valid file descriptor, whether there's an open file behind it or not. (I ...