-2

I'm using ubuntu, and want to create a custom alias in my .bashrc file, which execute

$xdg-open my_file_name.pdf

when I type

$pdf my_file_name

I'm sure there's an easy way to do that.

Thanks a lot !

BY0B
  • 99
  • 1
  • 9
hulyce
  • 438
  • 3
  • 15
  • 1
    Someone has asked a similar question: http://stackoverflow.com/questions/7131670/make-bash-alias-that-takes-parameter – evolutionxbox Aug 07 '15 at 13:46

1 Answers1

1

Don't use an alias; create a function, because you can't pass arguments to an alias.

pdf () {
    xdg-open "$1".pdf
}
chepner
  • 497,756
  • 71
  • 530
  • 681