Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

sed: sed "s/d/ ${PWD//\//\\\/}/g" failed.

0 views
Skip to first unread message

章宏九

unread,
Dec 18, 2009, 12:38:28 PM12/18/09
to bug-gn...@gnu.org
i know i am doing stupid things. :)

ubuntu@ubuntu-laptop:~$ echo "sdsds" > 1.txt ; sed
"s/d/\/home\/ubuntu/g" < 1.txt ; sed "s/d/ ${PWD//\//\\\/}/g" 1.txt
s/home/ubuntus/home/ubuntus
sed: -e expression #1, char 9: unknown option to `s'

ubuntu@ubuntu-laptop:~$ echo ${PWD//\//\\\/}
\/home\/ubuntu
ubuntu@ubuntu-laptop:~$ echo ${PWD//\//\\\/}
\/home\/ubuntu

ubuntu@ubuntu-laptop:~$ sed --version
GNU sed version 4.2.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
to the extent permitted by law.

GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <bug-gn...@gnu.org>.
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.

Thank you for your help.


Andreas Schwab

unread,
Dec 19, 2009, 5:06:10 AM12/19/09
to 章宏九, bug-gn...@gnu.org
章宏九 <seclud...@gmail.com> writes:

> i know i am doing stupid things. :)
>
> ubuntu@ubuntu-laptop:~$ echo "sdsds" > 1.txt ; sed
> "s/d/\/home\/ubuntu/g" < 1.txt ; sed "s/d/ ${PWD//\//\\\/}/g" 1.txt
> s/home/ubuntus/home/ubuntus
> sed: -e expression #1, char 9: unknown option to `s'
>
> ubuntu@ubuntu-laptop:~$ echo ${PWD//\//\\\/}
> \/home\/ubuntu

$ printf "%s\n" "${PWD//\//\\\/}"
\\/home\\/andreas

Andreas.

--
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."


0 new messages