How to change Absolute path to Relative path
Hello,
I have a doubt:- --------------------- Current script:- ################################################################################################ prefix=user@my-server: find . -depth -type d -name .git -printf '%h\0' | while read -d "" path ; do ( cd "$path" || exit $? name="`basename "$path"`" echo <command> "$prefix$PWD.git" ) done ################################################################################################# Output:- <command> user@my-server:/home/git/mirror/android/adb/OpenWnn.git <command> user@my-server:/home/git/mirror/android/adb/cts.git <command> user@my-server:/home/git/mirror/android/adb/dalvik.git <command> user@my-server:/home/git/mirror/android/adb/ndk.git ################################################################################################# Desired output:- <command> user@my-server:/android/adb/OpenWnn.git <command> user@my-server:/mirror/android/adb/cts.git <command> user@my-server:/android/adb/dalvik.git <command> user@my-server:/mirror/android/adb/ndk.git ################################################################################################## How shall i go about changing the absolute path to relative path, so that /home/git/mirror/android/adb/ndk.git gets converted to /mirror/android/adb/ndk.git //echo <command> "$prefix$PWD.git" ?? - anything for relative path?? ################################################################################################## |
Hello,
Please don't double post your question. It'll only confuse both you and us on where the conversation is taking place. Reported since it's a duplicate for this one. Kind regards, Eric |
This is a dupe. This is going to be closed. Now.
|
All times are GMT -5. The time now is 10:54 PM. |