Crazy_Bash
Crazy_Bash

Reputation: 1935

Alias: How can i send "alias" to background?

I would like to send alias with input parameters to a back

the alias:

alias aaa="/script.sh"

usage:

aaa input1 input2 inpu3

now i can send aaa to background by adding "&> /dev/null &" but adding this to an alias doesn't work because of the input

aaa input1 input2 inpu3 &> /dev/null &

what i have tried so far:

alias aaa="/script.sh &> /dev/null &"

Upvotes: 0

Views: 1247

Answers (3)

MostafaR
MostafaR

Reputation: 3695

Write another script file with code below inside it and make alias for that.

script2.sh:

./script.sh "$@" > /dev/null &

Make alias:

alias aaa="./script2.sh"

Upvotes: 0

nos
nos

Reputation: 229108

You can't do that with an alias. Make a function insted.

function aaa() {
   script.sh $@ &

}

aaa input1 input2 inpu3 > /dev/null

Upvotes: 11

poy
poy

Reputation: 10507

You could always just run it... Hit ctrl-z then type bg. This will run it in the background.

Upvotes: 0

Related Questions