332 questions
0
votes
2
answers
119
views
Custom bash completion obtaining from help text
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&...
1
vote
1
answer
76
views
zsh completion function (compdef) not completing _arguments
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 <...
0
votes
0
answers
51
views
bash complete to empty string while still escaping characters in file completions & appending / to dir completions
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 ...
0
votes
0
answers
61
views
Is it possible to manually invoke a specific bash-completion function on the command line?
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" ...
-2
votes
1
answer
170
views
How to write an autocompletion function in bashrc for words from history?
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 ...
0
votes
1
answer
45
views
Bash completion for a program in a specific directory
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 ...
0
votes
2
answers
66
views
How can I use bash auto-completion to list the contents of a directory literally named "="?
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 ...
2
votes
2
answers
172
views
How to include completions for one command in those of another
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> ...
0
votes
0
answers
40
views
Bash completion and the $cur variable
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 ...
1
vote
1
answer
85
views
Bash completion in wrapper scripts
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/...
1
vote
1
answer
81
views
How to take full advantage of Git Bash completion for a passthrough command that takes its own args?
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 ...
1
vote
1
answer
54
views
Git autocomplete custom command (not arguments after)
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/...
0
votes
1
answer
223
views
set the group variable in azure devops pipeline using bash script
#!/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
...
-4
votes
1
answer
64
views
Removing "\n" character while writing into a file in Shell Script
Here i am taking the text input from the yad ui field and then i am writing that text into a solc.c but that text contains some \n characters , which are directly being written into solc.c
#!/bin/bash
...
0
votes
0
answers
47
views
File compression and log rotation
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 ...