help writing a function or a script.
i'm trying to basically make a shortcut for krabby (see link) so i dont have to type <krabby name (pokemon name)> to see a specified pokemon. basically how can i make a script that passes the and to the output of what i type next?
Not 100% clear what you want to achieve, but you probably want an alias.
They'd have to make an alias for every Pokemon. What they need is a simple program that reads input and executes the
krabbycommand with that input as a parameter, then make it loop until it gets an exit command (or just Ctrl+C).I don't quite understand. Do you just want to type e.g.
k pikachuand that expands tokrabby name pikachu? Can you give an example of how you'd want to use it?You said see link but there's no link
goddammit i definitly added one. here:
https://github.com/yannjor/krabby
Still not clear what you're trying to do but assuming you're trying to manipulate the krabby output with a different program, the other poster's link on aliases should help you out. See the bottom section there on bash functions.
So for example if you're trying to store a krabby output to a specific folder, something like this:
alias_name () { mkdir /path/%1 && krabby name %1 | xargs mv -t /path/%1 }So in theory, typing something like
alias_name charizardwould, in this order, create a new folder at /path/charizard, run krabby charizard, and then place the output charizard file inside your new /path/charizard folder.I say in theory because I don't know what output krabby gives you and I don't know bash, I just googled how piping with xargs works right now. But maybe with this idea you can figure it out.
Do you know about tab autocomplete?
It would probably mean that you can just enter something like
QoL hacks FTW.
Found this on AskUbuntu. A few different ways there with a couple being quite easy. Probably going to try one of these myself in a bit.
Try asking Google Gemini or chatgpt to write the code for you. Most will these days. Then you can refine it based on what you're actually trying o achieve.