I need a quick ways to calculate age in days from a given date, so i use this command:
echo \(`date +%s`-`date -d '2012-04-01' +%s`\)/86400 | bc
Copy a Symbolic Link on Linux
The Problem:
I can't use cp to copy a symlinks to a directory, but i don't want to re-create it which could lead to typo problem due to long target path.
The Solution:
After quick search i found two working ways to do it.
First,
you still need to re-create then link but doesn't have to re-type target path, use readlink output instead.
ln -s `readlink ~/v1/jboss-deploy` ~/v2/jboss-deploy
In above command the `jboss-deploy` is a symlink to a directory somewhere in this box.
Second,
just use -P option on cp
cp -P ~/v1/jboss-deploy ~/v2/
well, then i should admit that i never read cp manual carefully... =="
I can't use cp to copy a symlinks to a directory, but i don't want to re-create it which could lead to typo problem due to long target path.
The Solution:
After quick search i found two working ways to do it.
First,
you still need to re-create then link but doesn't have to re-type target path, use readlink output instead.
ln -s `readlink ~/v1/jboss-deploy` ~/v2/jboss-deploy
In above command the `jboss-deploy` is a symlink to a directory somewhere in this box.
Second,
just use -P option on cp
cp -P ~/v1/jboss-deploy ~/v2/
well, then i should admit that i never read cp manual carefully... =="
Subscribe to:
Posts (Atom)