0

This is probably the worst question I've asked, I wasn't entirely sure how to formulate it and google results are best when the search is short and concise.

So, I keep finding myself constantly running a more or less identical list of commands in a Linux terminal. For example:

./some_script -argument1 -argument2 -argument3 [varying list of parameters that differ in type]

Now, the script and first 3 arguments are always the same. I was thinking if there is a way, such that a new script could be written, so that my entire input is much shorter. Like:

./new_script [varying list of parameters that differ in type]

1

2 Answers 2

2

This seems like a perfect place for an alias:

alias new_script='./some_script -argument1 -argument2 -argument3' 
Sign up to request clarification or add additional context in comments.

Comments

1

Create a file new_script in some directory in your PATH, for example in /usr/local/bin/. I usually create ~/bin directory and add it to PATH. Some people like to follow XDG specifications and add ~/.local/bin to PATH.

The file needs to have executable rights and following contents:

#!/bin/sh ./some_script -argument1 -argument2 -argument3 "$@" 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.