Saturday, September 30, 2023
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 2014  / 2 Years ago, tue, november 16, 2021, 2:41:42

I tried


alias sct='systemctl'
complete -F _systemctl sct

But the function _systemctl is not found until I run the original command systemctl in the session. This function loads dynamically or somehow and contains many other same functions inside.


OS - Ubuntu 20.04


More From » bash

 Answers
5

Create a file named /etc/bash_completion.d/systemctl:


if [[ -r /usr/share/bash-completion/completions/systemctl ]]; then
. /usr/share/bash-completion/completions/systemctl && complete -F _systemctl systemctl sct
fi

You can restart bash-completion by sourcing . /etc/bash_completion


[#1082] Tuesday, November 16, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rtbrbab

Total Points: 461
Total Questions: 126
Total Answers: 117

Location: Saudi Arabia
Member since Fri, Jul 1, 2022
1 Year ago
rtbrbab questions
;