V
V
Viktor Taran2019-04-01 14:54:38
bash
Viktor Taran, 2019-04-01 14:54:38

How to pass the required directory as an argument to the script?

The question is very simple, but you need to formulate it correctly in order to find it in googl ;(
There is a certain script in which I pass the name of the site, there is a directory in which there are these names, I want to add the site name with a tab,
for example
backup site1.ru - the latter can be added as if I am in folder with sites /var/www (for example)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2019-04-01
@saboteur_kiev

You can create custom autocomplete for your own command so that arguments are automatically completed.
To do this, you need to tinker with bash completion.
The entire autocomplete is created on bash scripts, and is connected in the global profile.
The scripts themselves are usually located somewhere here:
/etc/bash_completion
What to read - google about bash completion:
https://www.tldp.org/LDP/abs/html/ tabexpansion.html
https://debian-administration.org/article/316/An_i...
PS Although I saw you have zsh, maybe it has a simpler option.
PPS There is an even easier option - to make aliases or scripts with the full name and that's it =)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question