Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
82 views

I created a fresh WSL2 container of Ubuntu-24.04. Also, I created a new default user there that has different name than my Win user, moved the container file to another location. In general, the ...
PIoneer_2's user avatar
  • 556
4 votes
1 answer
110 views

The first positional argument to git switch can be a branch, e.g. git switch <branch> and it tab completes nicely. How can I make my own command with an argument that can tab complete into a ...
Moberg's user avatar
  • 5,656
0 votes
1 answer
70 views

How can bash completions match against one set of values, but insert a different associated value per match value? e.g., I want to match against, and display, text names, but I want to insert a ...
XDR's user avatar
  • 4,580
0 votes
2 answers
130 views

For some reason Bash completion doesn't work when I obtain from help text. This is my C++ file compiled and placed as dbcmd executable file in one of the PATHs: $ cat dbcmd.cpp #include <iostream&...
Ramanan T's user avatar
  • 533
1 vote
1 answer
189 views

I am writing an autocomplete function for my personal cli. Here below is a reduced version of my compdef. As I type my-cli <TAB> I can see the subcmd autocompleting. As I type my-cli macos <...
64rl0's user avatar
  • 122
0 votes
0 answers
59 views

TL;DR In bash (preferably bash 3+), how can I support empty string ('') as a completion (amongst others) for a value for an option for a command, while also supporting path completions for other ...
XDR's user avatar
  • 4,580
0 votes
0 answers
77 views

I have several scripts that expect a git branch as argument, rather than specifying the completion mechanism for all of these, is it possible to invoke a specific "completion activity" ...
Moberg's user avatar
  • 5,656
-2 votes
1 answer
187 views

How to write an autocompletion function in bashrc for previously used words (not commands in full) from history? For example less firstFile.txt gvim secondFile.txt Then suppose we want to ...
Sidharth C. Nadhan's user avatar
0 votes
1 answer
49 views

If I have a program located in /a/prog and /a is not in PATH, is it possible to specify a bash completion for running ./prog in /a so that it doesn't affect any other program named prog located ...
SU3's user avatar
  • 5,499
0 votes
2 answers
75 views

For example, using Tab to auto-complete, with a relative path: user:~$ ls -la /foo total 0 drwxr-xr-x 3 root root 60 Nov 9 22:31 . drwxr-xr-x 1 root root 260 Nov 9 22:31 .. drwxr-xr-x 5 root ...
ardnew's user avatar
  • 2,146
2 votes
2 answers
329 views

I have a command ts which takes as its arguments a command and that command's arguments. I want tab-completion to "do the right thing", namely: When I type, for example ts foo<tab> ...
DrHyde's user avatar
  • 1,725
0 votes
0 answers
66 views

I have some programs for which I've created some bash completion scripts, and those seem to work OK. I'd like to add some tests, and though this approach looked promising, but I get unexpected ...
jjg's user avatar
  • 1,120
1 vote
1 answer
142 views

I have a program foo for which I've written a bash-completion script, and that all works fine. I have dozens of wrapper-scripts bar1, bar2 ... which just sets one of the command-line options #/usr/...
jjg's user avatar
  • 1,120
1 vote
1 answer
94 views

I have created a custom Git command called git-profile. It uses the git-<command> naming convention to enable use as compword in Git Bash completion. implemented as a Bash script, that accepts a ...
Marĉjo's user avatar
  • 11
1 vote
1 answer
66 views

I've been trying to add an autocomplete for my custom command, "git extract-unmerged". I'm using git on Windows in git bash through MSYS2 if it matters. I created a bash script in $HOME/...
kreso's user avatar
  • 23
0 votes
1 answer
272 views

#!/bin/bash # Read Docker Compose file compose_file="docker-compose.yml" images=($(grep -E '^ *image:' $compose_file | awk '{print $2}' | cut -d ':' -f 1)) # Initialize group variable ...
Sʜɩvʌŋsʜ Tʜʌĸʋʀ's user avatar
-4 votes
1 answer
77 views

Here I am taking the text input from the YAD UI field, and then I am writing that text into a file solc.c, but that text contains some \n characters, which are directly being written into file solc.c. ...
ShashidharM's user avatar
0 votes
0 answers
52 views

I have a usecase to compress 5 days of log files and then delete 7 days data. My folder structure is as /user/var/logs/fw/2024-01.01/01.log. At the moment I have a cron which is rotating the logs ...
securityseeker's user avatar
1 vote
0 answers
212 views

Consider the following very simple bash autocompletion specification. #/usr/bin/env bash _foo () { local cur="${COMP_WORDS[$COMP_CWORD]}" # The following line, when uncommented, ...
Paul Grinberg's user avatar
0 votes
1 answer
442 views

I created a simple function in .bashrc to ssh into a specific machine and enter a specific tmux session: # Function to ssh to a machine with tmux connect() { local host=$1 local session=${2:-...
scripter's user avatar
  • 1,681
1 vote
1 answer
136 views

I'm writing a custom completion function for a bash script (this script is for activating deactivating nginx configuration files). I'm trying to have a different behavior if the completed word starts ...
Xalares's user avatar
  • 13
0 votes
1 answer
231 views

When using completion in git, for example on the git checkout command, all tags are returned. I have more and more tags, which makes reading quite unpleasant. user:~/repo$ git branch prod staging ...
matooouse's user avatar
0 votes
0 answers
226 views

Many confused programmers stumbled upon COMP_WORDBREAKS. The documentation states https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html : COMP_WORDBREAKS The set of characters that ...
KamilCuk's user avatar
  • 146k
1 vote
1 answer
66 views

I'm using the optparse-applicative library, which supports Bash-completion. I'd like to trigger such completion when typing :main <tab> within GHCi. Is there a way to instruct GHCi to use the ...
noteed's user avatar
  • 375
1 vote
1 answer
601 views

cnpg completion is designed to work when running like this: . <( kubectl cnpg completion bash ) however, when running on a k3s node, the proper way to run kubectl is either: k3s kubectl ... or, ...
Lockszmith's user avatar
  • 2,640
1 vote
0 answers
70 views

I am trying to create a bash completion for a custom function that I am creating: gco() { if [ -z "$1" ]; then branch="$(git branch --all | fzf | tr -d '[:space:]')" ...
wheeler's user avatar
  • 3,361
2 votes
0 answers
1k views

I add bash-completion for k3s by running: . <( k3s completion bash ) When I run the following, I only get bash-completion for kubectl ... and not k3s kubectl ...: . <( k3s kubectl completion ...
Lockszmith's user avatar
  • 2,640
0 votes
1 answer
136 views

In bash by default, pressing Tab will show all files and directories in the current directory. For example: cat a<tab><tab> would display something like aFile.txt apples.png aDirectory/ If ...
user avatar
1 vote
1 answer
85 views

Consider an environment variable that can take a list of arbitrary possible meaningful values. For an example of such an environment variable consider AWS_PROFILE. The list of possible values can be ...
bagratte's user avatar
  • 176
0 votes
1 answer
96 views

I have the following bash script cmd_complete () { make run echo -n "${PS1@P}" # print prompt again } complete -F cmd_complete -E bind "Space:complete" This script does ...
Emad Elsaid's user avatar
0 votes
1 answer
809 views

After sourcing the following code my terminal is able to see __hey function. super_tools() { case "$1" in "hey") __hey ;; *) ...
Bartek Lachowicz's user avatar
3 votes
1 answer
300 views

If I type git switch --no-guess <TAB><TAB> I am presented with a list of local branches as possible completions. If I don't pass --no-guess then both local and remote branches are ...
Zorzella's user avatar
  • 9,111
1 vote
2 answers
3k views

I would like to get Bash completions for code. How can that be done? I tried using the search bar to see if this had already been asked (is:q [vscode] bash completion, is:q [vscode] [bash-completion], ...
starball's user avatar
  • 59.7k
2 votes
0 answers
133 views

I am hoping to get Bash autocompletion to work with pytest. That is, suppose that I have a pytest file test_foo.py whose content is def test_case_simple(): pass then entering pytest test_foo.py:: ...
Bojian Zheng's user avatar
  • 2,957
0 votes
1 answer
296 views

Bash completion is working normally with Click 7.0 Environment: Python version: 3.9.9 Click version: 7.0 Bash version: 5.1.8 Bash-completion:2.11 This is the code: import click @click.group(cls=...
user21330572's user avatar
0 votes
3 answers
113 views

So I have a array of file names, that contain some tar files, So for example there are 2 file names in the array, acceptance-tests-0.0.134.tar and grafana-9.3.2-debian-11-r11.tar. How to we write a ...
Rohan Patel's user avatar
-1 votes
1 answer
44 views

I need a command that can ask the user for input and do something with the resuld such as run if they answer with a specific result. I tried read -p and i cant get input to work and i despretly need ...
That One Code Kid's user avatar
0 votes
1 answer
253 views

I have an array in arr which contains list of strings - (string1 string2 string3 ...) How do I append these elements to a text file one element per line. The elements could be of any data type. But I ...
Underoos's user avatar
  • 5,276
2 votes
3 answers
6k views

The script should be able to detect the operating system that is running. The alternatives OS is Arch Linux, Centos and Ubuntu. os=$(uname) if [ "$os" == "Arch" ]; then echo &...
Vegard's user avatar
  • 23
-1 votes
2 answers
92 views

In Programmable Completion Builtins complete command, there is a -I argument. It said: The -I option indicates that other supplied options and actions should apply to completion on the initial non-...
tinyhare's user avatar
  • 2,471
0 votes
0 answers
105 views

Ok so I want to write a bashfile system that tells a larger program that a file outputs this error message from chmod. bash: ./\[bashfile-name\].sh: /bin/bash^M: bad interpreter: No such file or ...
Citadel's user avatar
1 vote
1 answer
407 views

trying to create git alias alias gpo = "git push origin" but there doesn't seem to be a __git_complete for git push with an origin, __git_complete gpo _git_push wants to autocomplete the ...
Jae's user avatar
  • 45
0 votes
1 answer
43 views

The output to the terminal is correct, but it saves an empty line to the file. echo -n "Enter secret: " read secret echo $(/opt/homebrew/bin/oathtool --totp -b $secret) $(/opt/homebrew/bin/...
Katawa's user avatar
  • 1
0 votes
1 answer
489 views

I have a makefile. I want to ask for the name of the file that will be compiled in specific targets. When I wrote make to the bash and press the tab it suggests the targets in makefile. However, it ...
Ömer GÜZEL's user avatar
0 votes
1 answer
386 views

I have set up the following alias in my .gitconfig file: [alias] ss = stash show Unfortunately bash completion does not work correctly on this alias. When I type git ss <TAB>, I get: ❯ git ...
carlfriedrich's user avatar
1 vote
1 answer
472 views

Context I have an arduino-cli wrapper script named ino that reads target/build configuration from: JSON files located in the sketch directory Command-line flags/arguments It then constructs and exec'...
ardnew's user avatar
  • 2,146
0 votes
0 answers
87 views

I added to ~/.config/bashrc this line: . /usr/share/bash-completion/completions/git Bash completion works, but I lost Bash files completion, is it expected? Is it possible to have both?
Vitaly Zdanevich's user avatar
-1 votes
3 answers
485 views

i am new to bash and is trying to write a script that searches for some specific words in the codebase. But because there are a lot of false positives i also need to maintain a exclude_pattern list so ...
bourne's user avatar
  • 1,259
15 votes
4 answers
8k views

I have rustup+rust+cargo installed using the official installation script. How do I enable shell completions, to be able to type cargo <TAB> in the terminal and see the possible commands such as ...
AnonymousDuck's user avatar
2 votes
1 answer
1k views

Given a bash function in .bashrc such as kgp () { kubectl get po -n $1 $2 } Is it possible to have kubectl auto complete work for k8s resources such as namespaces/pods? As an example if I use ...
Kelvin Baumgart's user avatar

1
2 3 4 5
7