All Questions
5 questions
0
votes
1
answer
53
views
In a bash/zsh function how do I do something, then depending on the output, do A or B?
This function looks through each local git repository in folder ~/src, and does git pull on it. More and more I keep getting an error
Please commit your changes or stash them before you merge.
...
0
votes
2
answers
225
views
How to define the name of a bash function to be a regex
I've searched around and can't find an answer.
I want to define a function like this
function \d{2} () {
echo $1_or_smth
}
Then if I say in my terminal
12
I want it to echo 12 back.
14
votes
2
answers
29k
views
How to make custom zsh script executable automatically?
I must be missing something incredibly simple about how to do this, but I have a simple script:
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) ...
3
votes
1
answer
638
views
Are there any conventions for the name of global variable that holds function's result?
A typical way for a shell function to "return" its result is to assign it to some global variable.
Is there any convention/best-practice on the name of this variable?
1
vote
1
answer
61
views
How can a function call the function it "overrides"?
Suppose, for example, that fpath is set to
( $HOME/.zsh/my-functions /usr/local/share/zsh/site-functions )
...and that both function-defining files $HOME/.zsh/my-functions/quux and /usr/local/share/...