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]

monolith937
  • 429
  • 1
  • 4
  • 13

2 Answers2

2

This seems like a perfect place for an alias:

alias new_script='./some_script -argument1 -argument2 -argument3'
glenn jackman
  • 238,783
  • 38
  • 220
  • 352
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 "$@"
KamilCuk
  • 120,984
  • 8
  • 59
  • 111