Home > database >  Use alias and add variable together
Use alias and add variable together

Time:10-21

I found nice command to check whether in terminal:

curl wttr.in/

By adding after slash city name it will show whether in typed place for example:

curl wttr.in/NewYork

There is need to simplify this command using alias but then it appear a problem with variable after alias.

alias yyy="curl wttr.in/"

There is error trying to use alias with variable in terminal:

yyy NewYork 

How manage to use alias with variable?

CodePudding user response:

You can create a function instead

function yyy() { curl wttr.in/${1}; }

and use it the same way you use an alias

yyy NewYork
  • Related