What's the simplest way on Linux to "copy" a directory hierarchy so that a new hierarchy of directories are created while all "files" are just symlinks pointing back to the actual files on the source hierarchy?
'cp -s' does not work recursively.
Thanks!
-Max
...
Hi,
I've installed enscript on my mac. But don't get it to print the complete project directory (with subdirectories). Which command would I use to print all *.as and *.mxml files including subdirs?
thx
daniel
...
A single installation of our product stores it's configuration in a set of database tables.
None of the installations 'know' about any other installation.
It's always been common for customers to install multiple copies of our product in different datacentres, which are geographically far apart. This means that the configuration infor...
How can you copy a folder to /var/www without sudo?
My folder codes has the following permissions at /var/www
4 drwxr-xr-x 8 root root 4096 2009-08-09 03:01 codes
I can only sudo cp -r ~/Dropbox/codes/ /var/www to copy the files.
I cannot copy them without sudo.
...
In Perl, is it possible to make 'exec', 'system', and 'qx' use a shell other than /bin/sh (without using a construct like 'exec "$SHELL -c ..."', and without recompiling perl)?
EDIT: The motivation for this question is a bash script that does 'export -f foo' and then uses perl in a subshell to invoke the function directly via 'system "...
I want to programatically change the hour which certain cron jobs execute.
I'm not sure whether I'm going about this the right way, but here's the plan.
Jobs which are subject to change will have a comment on the end of the line "#change-enabled".
15 5 7,14,21,28 * * /path/to/executable1 #change-enabled
15 * * * * /path/to/executable2
...
I have this program in C++ that forks two new processes:
#include <pthread.h>
#include <iostream>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <cstdlib>
using namespace std;
int shared;
void func(){
extern int shared;
for (int i=0; i<10;i++)
shared++;
cout<<"Process "<<getpid()<<", shared "
...
Hey all.
I have trouble passing a variable from inside a loop.
Code:
# find all output.txt that has been modified last 24h ...
PROCESSED=1
find ${PROCESSED_DIR} -mtime -1 -name "output.txt" | while read i
do
# .. and compare those with TMP_TXT
if diff $i ${TMP_TXT} > /dev/null
then
# If both are same EXIT search...
Hi,
I'm diffing a bunch of binary files, recursively.
Basically, I'm running:
diff --recursive --brief dir_a dir_b
And this tells me which files differ, and which are only present in one of the locations.
I'd like to get a bit more information, roughly, how much different they are from one another. A percentage would do.
Is there ...
Im completely new to Bash scripting but I've been told, with little help, to create a file that compresses textures into PVR format only if the file has been modified since the last time the script was run. Heres the code I have so far:
# variables
TEXTURE_TOOL=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool
INPUT...
I'm trying to convert a large number of files from a plain text layout to CSV. The first few lines of one of the files looks like this:
SLICE AT X= -0.25
ELEM NO XI-COORD INWARD-NORMAL
1 0 0.000 0.000 0.000 0.000 0.000 0.000
2 0 0.000 0.000 0.000 0.000 0.000 0.000
3 ...
sort provides two kinda of numeric sorts. This is from the man page on OS X:
-g, --general-numeric-sort
compare according to general numerical value
-n, --numeric-sort
compare according to string numerical value
What's the difference?
...
Hello all,
I am using the following call for executing the 'aspell' command on some strings in Python:
r,w,e = popen2.popen3("echo " +str(m[i]) + " | aspell -l")
I want to test the success of the function looking at the stdout File Object r. If there is no output the command is successful.
What is the best way to test that in Python?...
If I run this on OS X:
last -10 | awk '{print $1}'
I get:
chop
chop
chop
chrihopk
reboot
shutdown
chop
chop
chop
chrihopk
How do I use sed or awk to obtain the most frequent user 'chop'?
ADDITIONAL EDIT TO QUESTION:
Our local admin account interferes with the results (username: support) and often we have a new starter on a clie...
Hi,
In my shell script i have the following line:
export PATH=$PATH:/home/$USER/somedir.
Say im logged in as user mike . I need to execute the shell script as root, so i run it as sudo filename.sh, so $USER becomes root in my path in that case .
I want it to be that of the user running the script, i.e. mike instead of root. Is there...
Hi,
This keeps happening to me all the time:
1) I write a script(ruby, shell, etc).
2) run it, it works.
3) put it in crontab so it runs in a few minutes so I know it runs from there.
4) It doesnt, no error trace, back to step 2 or 3 a 1000 times.
When I ruby script fails in crontab, I can't really know why it fails cause when I pipe o...
sed 's/^#//g' < kam_account_calls.txt > kam_account_calls1.txt
This command removes # from the start of the line.
Please let me know how to adopt the same functionality in the Windows command shell.
...
I'm trying to copy a chunk from one binary file into a new file. I have the byte offset and length of the chunk I want to grab.
I have tried using the dd utility, but this seems to read and discard the data up to the offset, rather than just seeking (I guess because dd is for copying/converting blocks of data). This makes it quite slow ...
I'm not necessarily looking for a better way to do this, rather an explanations of the output would greatly be appreciated. Recently, a senior programmer asked me why his code worked but only for one instance. What I came to find out was that it worked every other occurrence. Here is my example:
#!/usr/bin/perl -w
use strict;
my @li...
I'm working on a program which will be taking in user input from the console as well as printfing out in a separate thread. I want to avoid situations where the user is halfway through typing something in and a printf comes along and prints itself at the cursor.
Is there a way to do non-blocking io in c from the console window? Ideally,...