|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I'd like to write a script that adds the current directory to the line in .bash_profile. I'm not too familiar with sed so , is it possible to do this solely from the bash shell, or can someone suggest a script using sed ? Thanx GC |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 virus wrote: > I'd like to write a script that adds the current directory to the line in .bash_profile. > I'm not too familiar with sed so , is it possible to do this solely from the bash shell, or can someone suggest a script using sed ? > > > Thanx > GC > Erm: $(pwd) >> /path/to/.bash_profile b.r., - -- Stephan 'smg' Grein, <stephan at stephan minus rockt dot de> http://stephangrein.de GnuPG-Key-ID: 0xF8C275D4 FingerPrint: 5B6F 134A 189B A24D 342B 0961 8D4B 0230 F8C2 75D4 Geek by nature, Linux by choice. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iQIVAwUBROgyuI1LAjD4wnXUAQIs+w//Ywh9XIu9JcL1gRfuqIRTCgMJH9MSnZSZ MRT6V6845dfUuIsQhaeozvQB+jW3hD96PVmbma4jKptkto4nd0 oUTRSrcIGETalJ qspDLr8J82UIWX8C4KO5OfHUna3+EwqxV4v8pGPYvj4dKDRN5M G5H7FwCpz/C3M+ Hn9XOrM+25VEy08pscVEvxfTypEO7YqqUVgGLVtW7dbfH51HhL gqjyz9kNWBxu2+ Nd79N0LVT6tKhZirpZJK+2NLeZ8W85uF8ry/0FYh3pDpkBKOCo+1Nc6JI7imZQ06 gumBEVxP+rJc6Fud53BxZI9Dms5Fqg7j1TTbB85GtmxdSfgSKz OEKdPkl8lx6Sp6 DW1yAg3+k/UIq00sUEdLTSXwX4RtgM6XwiU8O8apFgc4lXC7FlQz9k6WlZcQ mjqp 6i87oBpF1WRW+ZMTZp/AuNord898UkPPVuJrVHZKayI1/xX5ECJ/yzXrq3Li/Nx7 Y0QsXwd+XC0E3glwv9lAEaeFIzWN0olxcnUmV+XWxQEpAxB6oT +s8SU6GuvwZTAx T8axKHprmK47+KTWT7rjcsL3CnH7Ow4gReIhlUA4Nrxtx2phUJ Quh6TUCd6CLhs+ LWF7bbq2RqqOQWP1zUt+lP+MoX0k6okBIwTilEg8kQ1IX6KdGd 54GLqNBrxxmuZL rdyZ5vgDCyc= =oMQc -----END PGP SIGNATURE----- |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On 2006-08-20, virus wrote:
> > I'd like to write a script that adds the current directory to the > line in .bash_profile. Don't. While adding the current directory to the PATH is a minor security risk, it is unnecessary. > I'm not too familiar with sed so , is it possible to do this solely > from the bash shell, or can someone suggest a script using sed ? printf "\nPATH=%s:$PATH\n" "." >> $HOME/.bashrc -- Chris F.A. Johnson, author <http://cfaj.freeshell.org> Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) ===== My code in this post, if any, assumes the POSIX locale ===== and is released under the GNU General Public Licence |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
"virus" <virus@clear.net.nz> writes:
> I'd like to write a script that adds the current directory to the line in .bash_profile. Bad idea. It's much safer to learn to type instead of script to type ./script and once it's working, do mv script ~/bin (and have ~/bin in your search path) I used a program called "ls" in my home directory that caught a lot of people who put "." in their searchpath. if you INSIST on doing it, make sure it's LAST in the path. -- Sending unsolicited commercial e-mail to this account incurs a fee of $500 per message, and acknowledges the legality of this contract. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
virus wrote:
> I'd like to write a script that adds the current directory to the line in .bash_profile. > I'm not too familiar with sed so , is it possible to do this solely from the bash shell, or can someone suggest a script using sed ? > > > Thanx > GC > Do you mean to add the current dir to your search path? Add a dot at the end of your path in .bashrc is enough. Do not forget to separate path's with : |
|
![]() |
| Outils de la discussion | |
|
|