I'm trying to figure out if it's possible to include a query in an alias for use in the terminal. For example, can I create an alias like this: `alias aw='firefox --private-window "https://wiki.archlinux.org/index.php?search={query}" &'?
4 Answers
You might also want to check out resources and pages that provide info on creating aliases and scripts. Just be careful with your commands!
Absolutely! You can set up an alias for just about anything, though it really gets tricky with longer scripts. If you find yourself needing to do more complex stuff, creating a separate bash script and then aliasing that is usually cleaner.
You can define a function like this:
```bash
aw () {
firefox --private-window "https://wiki.archlinux.org/index.php?search={$@}"
}
```
Just make sure to use `$@` to handle search queries that have spaces. If the Arch wiki can't manage that, stick with `$1` to only pass the first argument.
It's a pretty neat setup!
If you're looking for a straightforward way to include arguments, give `$1` a shot! Here’s a handy link for bash scripting tips, too.

I tried that, but it still just opens the Arch wiki site directly. I think I might just go ahead and write a full script for a more universal solution.