ROOT=`pwd | sed 's%\(.*/myABC\)/.*%\1%'`
This is a shell command , I believe the purpose is to find root path of this project.
I am not so sure how this work.
Could anyone help explain it for me?
Thank you so much
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
you are in the directory path
/home/youruser/myABC/some/other/deeper/dir
and you use these command the path will be truncated to only /home/youruser/myABC/.
sed – is a string editing tool
s% – substitute the string of pwd and use ‘%’ as separator
\(.*/myABC\)/.* – capture a string which contains myABC and save this in the first parameter
\1 – print first parameter
best regards kenny