You are not logged in.

#1 2010-06-09 04:45:28

teh
Member
From: Tijuana, Mexico
Registered: 2009-07-07
Posts: 374
Website

Noob request about alias.

I've read the man and search (a lot) for options in alias, like -s, -d, -g...

So, any good manual please?

Last edited by teh (2010-06-09 04:48:23)


arst

Offline

#2 2010-06-09 05:06:33

sand_man
Member
From: Australia
Registered: 2008-06-10
Posts: 2,164

Re: Noob request about alias.

I don't think you can do that with alias's but you can put functions in your bashrc which work the same way.
Take for instance, this:

start(){
  for arg in $*; do
    sudo /etc/rc.d/$arg stop
  done
}

neutral

Offline

#3 2010-06-09 05:42:11

teh
Member
From: Tijuana, Mexico
Registered: 2009-07-07
Posts: 374
Website

Re: Noob request about alias.

hmmm... This is what I'm talking about:

http://github.com/Barrucadu/home/blob/m … sh/aliases

I've got a hint reading commented lines: -g for Global and -s for Suffix. But still...


And this has the same options(¿?) parameters (¿?):

http://github.com/mikar/config/blob/master/.zshrc


arst

Offline

#4 2010-06-09 05:50:08

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Noob request about alias.

You're using zsh, I presume?

Both of those examples are for zsh.

Offline

#5 2010-06-09 06:41:22

sand_man
Member
From: Australia
Registered: 2008-06-10
Posts: 2,164

Re: Noob request about alias.

Now I'm lost...


neutral

Offline

#6 2010-06-09 07:17:39

teh
Member
From: Tijuana, Mexico
Registered: 2009-07-07
Posts: 374
Website

Re: Noob request about alias.

Ok, nevermind... I've got it.

I didn't know that *sh lets you specify more than just a character or a string (without quotations marks) to set the alias...


Example:

alias -s pdf='zathura'

Then just type foo.pdf -s pdf and done...


So noob, sorry =P I thought those "options" was part of an alias or zsh functions.

Send this to /dev/zero please =P

Last edited by teh (2010-06-09 07:18:16)


arst

Offline

#7 2010-06-09 07:47:59

Barrucadu
Member
From: York, England
Registered: 2008-03-30
Posts: 1,158
Website

Re: Noob request about alias.

They are options for the alias:

alias -s pdf='zathura'
/path/to/file.pdf

…and zathura opens smile

Offline

#8 2010-06-09 11:10:50

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: Noob request about alias.

teh wrote:
alias -s pdf='zathura'

Then just type foo.pdf -s pdf and done...

Why do you type that last line? You should just execute

foo.pdf

and zathura should open it.

Offline

#9 2010-06-13 14:13:59

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: Noob request about alias.

-g means global (anywhere on cmd line) and -s means suffix (use this program when i type a file name with this extension). Both are zsh features, bash has neither. These are zsh's alias flags (generated with tab completion):

-L  -- print each alias in the form of calls to alias
-g  -- list or define global aliases
-m  -- print aliases matching specified pattern
-r  -- list or define regular aliases
-s  -- list or define suffix aliases

Last edited by JohannesSM64 (2010-06-13 14:15:59)

Offline

#10 2010-06-13 16:21:30

teh
Member
From: Tijuana, Mexico
Registered: 2009-07-07
Posts: 374
Website

Re: Noob request about alias.

¡Thank you JohannesSM64!


arst

Offline

Board footer

Powered by FluxBB