link to dos2unix

2009-03-01 Thread Fbsd1
I use the dos2unix console command all the time. I am tried to typing in 
that long name. I tried to do a hard link on it.

ln /usr/local/bin/dos2unix /usr/local/bin/d2u
This command is accepted without error, but when it execute it
d2u .txt
I get message ==oops you renamed me using unix2dos instead.
I also tried
ln -s /usr/local/bin/dos2unix /usr/local/bin/d2u
and got same results. ls -l does not show dos2unix as linked all ready.

What am I doing wrong here?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: link to dos2unix

2009-03-01 Thread Wojciech Puchar

long name. I tried to do a hard link on it.
ln /usr/local/bin/dos2unix /usr/local/bin/d2u
This command is accepted without error, but when it execute it
d2u .txt
I get message ==oops you renamed me using unix2dos instead.
I also tried
ln -s /usr/local/bin/dos2unix /usr/local/bin/d2u
and got same results. ls -l does not show dos2unix as linked all ready.

What am I doing wrong here?


it HAS to be called dos2unix - this program reacts on the name it was 
called as because dos2unix and unix2dos are the same binary.


if called as d2u - it doesn't know what to do.

use shell aliases
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: link to dos2unix

2009-03-01 Thread Roland Smith
On Sun, Mar 01, 2009 at 05:00:27PM +0800, Fbsd1 wrote:
 I use the dos2unix console command all the time. I am tried to typing in 
 that long name. I tried to do a hard link on it.
 ln /usr/local/bin/dos2unix /usr/local/bin/d2u
 This command is accepted without error, but when it execute it
 d2u .txt
 I get message ==oops you renamed me using unix2dos instead.
 I also tried
 ln -s /usr/local/bin/dos2unix /usr/local/bin/d2u
 and got same results. ls -l does not show dos2unix as linked all ready.
 
 What am I doing wrong here?

Usually, programs like this perform dos2unix or unix2dos translations
depending on how they are called. So renaming them won't work.

Try adding an alias to your favorite shell. That should work. E.g.put
'alias d2u dos2unix' and 'alias u2d unix2dos' in your .cshrc.

Roland
-- 
R.F.Smith   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)


pgpBuXLQC5oa5.pgp
Description: PGP signature


Re: link to dos2unix

2009-03-01 Thread Fbsd1

Roland Smith wrote:

On Sun, Mar 01, 2009 at 05:00:27PM +0800, Fbsd1 wrote:
I use the dos2unix console command all the time. I am tried to typing in 
that long name. I tried to do a hard link on it.

ln /usr/local/bin/dos2unix /usr/local/bin/d2u
This command is accepted without error, but when it execute it
d2u .txt
I get message ==oops you renamed me using unix2dos instead.
I also tried
ln -s /usr/local/bin/dos2unix /usr/local/bin/d2u
and got same results. ls -l does not show dos2unix as linked all ready.

What am I doing wrong here?


Usually, programs like this perform dos2unix or unix2dos translations
depending on how they are called. So renaming them won't work.

Try adding an alias to your favorite shell. That should work. E.g.put
'alias d2u dos2unix' and 'alias u2d unix2dos' in your .cshrc.

Roland


Thank you. That worked.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: link to dos2unix

2009-03-01 Thread Lars Eighner

On Sun, 1 Mar 2009, Fbsd1 wrote:


I get message ==oops you renamed me using unix2dos instead.


Someone else has already replied that the binary only knows what to
do by checking the name used to call it.  The way to do what you want
is to use an alias in your shell.  In BASH this would be

alias d2u='dos2unix'

in .profile.

Then run source .profile, or log out and log in.

This may vary according to which shell you use.  Consult the man
for your shell.

The reason this works is that the shell resolves the alias before it
calls the command, so the command never knows what you really typed.

A number of applications are like this.  Aliasing is the right way to make
shortcut names, rather than creating links.  If you want the alias to work
system-wide, edit the system confifuration file for the particular shell. 
If users use several different shell, you do have to add the alias to each

distinct configuration file.


--
Lars Eighner
http://www.larseighner.com/index.html
8800 N IH35 APT 1191 AUSTIN TX 78753-5266

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org