I am a beginner at Bash scripting and I am getting an error saying this when I run my code:
main.sh: line 7: ((: -w /etc/shadow : division by 0 (error token is «etc/shadow «)
The following is the code I wrote in main.sh:
#!/usr/bin/env bash
if [ -e /etc/shadow ]
then
echo "Shadow passwords are enabled."
if (( -w /etc/shadow ))
then
echo "You have permissions to edit /etc/shadow"
else
echo "You do NOT have permissions to edit /etc/shadow"
fi
else
echo "Shadow passwords are not enabled."
fi
The result after running the code also gave:
Shadow passwords are enabled.
You do NOT have permissions to edit /etc/shadow
This was given before the error message. Does anyone have any suggestions for how to fix this problem and what the error message means? Thanks!
asked Jun 16, 2020 at 21:36
4
You should use [[ ... ]]
(preferred, bash-only) or [ ... ]
(can cause problems, POSIX compliant) instead of (( ... ))
: they are adequate for comparing text, while (( ... ))
is an arithmetic context and only accepts mathematical operations. The error occurs because it tries to use the /
s in the path for division.
That error counts as a false for the if, making you run the else
block.
if [[ -w /etc/shadow ]]
then
# ...
A good reference for using if
in bash is the Bash Beginner Guide.
answered Jun 17, 2020 at 0:47
0
The second attempt doesn’t produce an error, but it doesn’t work fine, assuming that your attempt is to test whether the file contains at least one line.
The output of wc -l "/disk1/environment.sh"
consists of the number of lines in the file, a space and the file name. If you want to use the number of lines, you need to extract it. Rather than split the output, there’s an easier way: instead of passing the file name on the command line, redirect the output of wc
from the file. Then wc
only prints the number with no file name.
if [[ $(wc -l <"/disk1/environment.sh") -ge 0 ]];then
echo "File has data"
fi
Or, since you’re using bash syntax anyway,
if (($(wc -l <"/disk1/environment.sh") >= 0)); then
echo "File has data"
fi
Of course this is always true since the number of lines is always greater or equal to 0. But you can get useful results with other numbers.
In your first attempt, you use the -ge
operator. This is an operator on integers. You get an error message because the left-hand side is not an integer, but something like 42 /disk1/environment.sh
.
In your second attempt, you use the <
operator in a conditional statement. This operator is string comparison (in lexical order). It so happens that the output of wc -l /disk1/environment.sh
is always ordered lexically after 0
, since it starts with a digit, therefore [[ $(wc -l <"/disk1/environment.sh") > 0 ]]
is always true. The exception is when /disk1/environment.sh
doesn’t exist; in this case wc -l
produces nothing on standard output (it writes an error message to standard error instead), and the comparison is false.
Comparing the number of lines in a file to 0 is not very useful. On modern systems, wc -l
counts the number of newlines. In a text file, the number of newlines is 0 only if the file is empty. (In general wc -l
returns 0 if the file doesn’t contain any newline character; a text file contains a newline at the end of each line, and the number of newlines in non-text files is rarely useful information.) There’s an operator in conditional expressions to test if a file is empty, you don’t need to invoke wc
.
if [[ ! -e /disk1/environment.sh ]]; then
if [[ -L /disk1/environment.sh ]]; then
echo "/disk1/environment.sh is a broken symbolic link"
else
echo "/disk1/environment.sh does not exist"
fi
elif [[ ! -r /disk1/environment.sh ]]; then
echo "/disk1/environment.sh exists but is not readable"
elif [[ ! -s /disk1/environment.sh ]]; then
echo "/disk1/environment.sh is empty or is a special file (name pipe, etc.)"
else
echo "/disk1/environment.sh is not empty"
fi
Содержание
- Bash command line exit codes demystified
- More Linux resources
- Extracting the elusive exit code
- Exit status 0
- Exit status 1
- Exit status 2
- Exit status 126
- Exit status 127
- Exit status 128
- Exit status 130
- Exit status 255
- Wrapping up
- Bash test wc with ‘-ge’ — division by 0 error
- 2 Answers 2
- [BUG] Division by 0 at startup #49
- Comments
- Footer
- RANDOM%0: division by 0 (error token is «0») about freenom-script HOT 1 CLOSED
- Comments (1)
- Related Issues (20)
- Recommend Projects
- React
- Vue.js
- Typescript
- TensorFlow
- Django
- Laravel
- Recommend Topics
- javascript
- server
- Machine learning
- Visualization
- Recommend Org
- Microsoft
Bash command line exit codes demystified
Posted: February 4, 2020 |
More Linux resources
When you execute a command or run a script, you receive an exit code. An exit code is a system response that reports success, an error, or another condition that provides a clue about what caused an unexpected result from your command or script. Yet, you might never know about the code, because an exit code doesn’t reveal itself unless someone asks it to do so. Programmers use exit codes to help debug their code.
Note: You’ll often see exit code referred to as exit status or even as exit status codes. The terms are used interchangeably except in documentation. Hopefully my use of the two terms will be clear to you.
I’m not a programmer. It’s hard for me to admit that, but it’s true. I’ve studied BASIC, FORTRAN, and a few other languages both formally and informally, and I have to say that I am definitely not a programmer. Oh sure, I can script and program a little in PHP, Perl, Bash, and even PowerShell (yes, I’m also a Windows administrator), but I could never make a living at programming because I’m too slow at writing code and trial-and-error isn’t an efficient debugging strategy. It’s sad, really, but I’m competent enough at copying and adapting found code that I can accomplish my required tasks. And yet, I also use exit codes to figure out where my problems are and why things are going wrong.
Exit codes are useful to an extent, but they can also be vague. For example, an exit code of 1 is a generic bucket for miscellaneous errors and isn’t helpful at all. In this article, I explain the handful of reserved error codes, how they can occur, and how to use them to figure out what your problem is. A reserved error code is one that’s used by Bash and you shouldn’t create your own error codes that conflict with them.
Enough backstory. It’s time to look at examples of what generates error codes/statuses.
To display the exit code for the last command you ran on the command line, use the following command:
The displayed response contains no pomp or circumstance. It’s simply a number. You might also receive a shell error message from Bash further describing the error, but the exit code and the shell error together should help you discover what went wrong.
Exit status 0
An exit status of 0 is the best possible scenario, generally speaking. It tells you that your latest command or script executed successfully. Success is relative because the exit code only informs you that the script or command executed fine, but the exit code doesn’t tell you whether the information from it has any value. Examples will better illustrate what I’m describing.
For one example, list files in your home directory. I have nothing in my home directory other than hidden files and directories, so nothing to see here, but the exit code doesn’t care about anything but the success of the command’s execution:
The exit code of 0 means that the ls command ran without issue. Although, again, the information from exit code provides no real value to me.
Now, execute the ls command on the /etc directory and then display the exit code:
You can see that any successful execution results in an exit code of 0, including something that’s totally wrong, such as issuing the cat command on a binary executable file like the ls command:
Exit status 1
Using the above example but adding in the long listing and recursive options ( -lR ), you receive a new exit code of 1:
Although the command’s output looks as though everything went well, if you scroll up you will see several «Permission denied» errors in the listing. These errors result in an exit status of 1, which is described as «impermissible operations.» Although you might expect that a «Permission denied» error leads to an exit status of 1, you’d be wrong, as you will see in the next section.
Dividing by zero, however, gives you an exit status of 1. You also receive an error from the shell to let you know that the operation you’re performing is «impermissible:»
Without a shell error, an exit status of 1 isn’t very helpful, as you can see from the first example. In the second example, you know why you received the error because Bash tells you with a shell error message. In general, when you receive an exit status of 1, look for the impermissible operations (Permission denied messages) mixed with your successes (such as listing all the files under /etc , as in the first example in this section).
Exit status 2
As stated above, a shell warning of «Permission denied» results in an exit status of 2 rather than 1. To prove this to yourself, try listing files in /root :
Exit status 2 appears when there’s a permissions problem or a missing keyword in a command or script. A missing keyword example is forgetting to add a done in a script’s do loop. The best method for script debugging with this exit status is to issue your command in an interactive shell to see the errors you receive. This method generally reveals where the problem is.
Permissions problems are a little less difficult to decipher and debug than other types of problems. The only thing «Permission denied» means is that your command or script is attempting to violate a permission restriction.
Exit status 126
Exit status 126 is an interesting permissions error code. The easiest way to demonstrate when this code appears is to create a script file and forget to give that file execute permission. Here’s the result:
This permission problem is not one of access, but one of setting, as in mode. To get rid of this error and receive an exit status of 0 instead, issue chmod +x blah.sh .
Note: You will receive an exit status of 0 even if the executable file has no contents. As stated earlier, «success» is open to interpretation.
I receiving an exit status of 126. This code actually tells me what’s wrong, unlike the more vague codes.
Exit status 127
Exit status 127 tells you that one of two things has happened: Either the command doesn’t exist, or the command isn’t in your path ( $PATH ). This code also appears if you attempt to execute a command that is in your current working directory. For example, the script above that you gave execute permission is in your current directory, but you attempt to run the script without specifying where it is:
If this result occurs in a script, try adding the explicit path to the problem executable or script. Spelling also counts when specifying an executable or a script.
Exit status 128
Exit status 128 is the response received when an out-of-range exit code is used in programming. From my experience, exit status 128 is not possible to produce. I have tried multiple actions for an example, and I can’t make it happen. However, I can produce an exit status 128-adjacent code. If your exit code exceeds 256, the exit status returned is your exit code subtracted by 256. This result sounds odd and can actually create an incorrect exit status. Check the examples to see for yourself.
Using an exit code of 261, create an exit status of 5:
To produce an errant exit status of 0:
If you use 257 as the exit code, your exit status is 1, and so on. If the exit code is a negative number, the resulting exit status is that number subtracted from 256. So, if your exit code is 20, then the exit status is 236.
Troubling, isn’t it? The solution, to me, is to avoid using exit codes that are reserved and out-of-range. The proper range is 0-255.
Exit status 130
If you’re running a program or script and press Ctrl-C to stop it, your exit status is 130. This status is easy to demonstrate. Issue ls -lR / and then immediately press Ctrl-C:
There’s not much else to say about this one. It’s not a very useful exit status, but here it is for your reference.
Exit status 255
This final reserved exit status is easy to produce but difficult to interpret. The documentation that I’ve found states that you receive exit status 255 if you use an exit code that’s out of the range 0-255.
I’ve found that this status can also be produced in other ways. Here’s one example:
Some independent authorities say that 255 is a general failure error code. I can neither confirm nor deny that statement. I only know that I can produce exit status 255 by running particular commands with no options.
Wrapping up
There you have it: An overview of the reserved exit status numbers, their meanings, and how to generate them. My personal advice is to always check permissions and paths for anything you run, especially in a script, instead of relying on exit status codes. My debug method is that when a command doesn’t work correctly in a script, I run the command individually in an interactive shell. This method works much better than trying fancy tactics with breaks and exits. I go this route because (most of the time) my errors are permissions related, so I’ve been trained to start there.
Have fun checking your statuses, and now it’s time for me to exit.
[ Want to try out Red Hat Enterprise Linux? Download it now for free. ]
Источник
Bash test wc with ‘-ge’ — division by 0 error
Below script is throwing error :
line 2: [[: 5 /disk1/environment.sh: division by 0 (error token is «/environment.sh»)
But the below code is working fine :
Could some one please tell me why ‘-ge’ and ‘>’ is behaving different here ?
bash version : GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
2 Answers 2
That’s because of the output from wc -l /filename , this would output e.g.:
but you are doing integer comparison (operator: -ge ), hence the extraneous portion /filename is invalid leading to the error message.
Just pass the filename to wc via STDIN so that wc just returns the count:
In the second case, [[ $(wc -l /disk1/environment.sh) > 0 ]] , you are simply checking if the output from command substitution, $(wc -l /disk1/environment.sh) , sorts after 0 , lexicographically; which will always be the case unless wc returns some error and produces nothing on STDOUT.
Just to note, [[ does not support arithmetic operators like > , >= , , , you need the (( keyword for these:
The second attempt doesn’t produce an error, but it doesn’t work fine, assuming that your attempt is to test whether the file contains at least one line.
The output of wc -l «/disk1/environment.sh» consists of the number of lines in the file, a space and the file name. If you want to use the number of lines, you need to extract it. Rather than split the output, there’s an easier way: instead of passing the file name on the command line, redirect the output of wc from the file. Then wc only prints the number with no file name.
Or, since you’re using bash syntax anyway,
Of course this is always true since the number of lines is always greater or equal to 0. But you can get useful results with other numbers.
In your first attempt, you use the -ge operator. This is an operator on integers. You get an error message because the left-hand side is not an integer, but something like 42 /disk1/environment.sh .
In your second attempt, you use the operator in a conditional statement. This operator is string comparison (in lexical order). It so happens that the output of wc -l /disk1/environment.sh is always ordered lexically after 0 , since it starts with a digit, therefore [[ $(wc -l 0 ]] is always true. The exception is when /disk1/environment.sh doesn’t exist; in this case wc -l produces nothing on standard output (it writes an error message to standard error instead), and the comparison is false.
Comparing the number of lines in a file to 0 is not very useful. On modern systems, wc -l counts the number of newlines. In a text file, the number of newlines is 0 only if the file is empty. (In general wc -l returns 0 if the file doesn’t contain any newline character; a text file contains a newline at the end of each line, and the number of newlines in non-text files is rarely useful information.) There’s an operator in conditional expressions to test if a file is empty, you don’t need to invoke wc .
Источник
[BUG] Division by 0 at startup #49
Describe the bug
When launching bashtop an division by zero occur line 1590
Info (please complete the following information):
Linux distribution and version :
Ubuntu Server 18.04 bionic
Bash version (version 4.4 or above is required) :
version 4.4.20(1)-release
Additional context
error.log :
The text was updated successfully, but these errors were encountered:
Would you mind running bashtop —debug and then pasting the resulting «$HOME/.config/bashtop/tracing.log»
You can compress it and mail it, if it becomes too large to paste here.
Hi,
i have the same problem as @Vincent-HD, but my Ubuntu is running in a Parallels container.
It seems that lscpu reports 0 CPUs when running in a container.
The nproc command returns the correct number of CPUs.
Sure can add so if cpu output from lscpu is 0 then use nproc , but also need a secondary way of getting number of threads in that case, since nproc only gives number of cores.
@andresth Can you run cat /sys/devices/system/cpu/present and post the output?
The file /sys/devices/system/cpu/present doesn’t exist on my server, but there is a file called /sys/devices/system/cpu/possible which contains 0-3
Btw I don’t think there is a difference between cores and threads in a container environment.
You could check for the Virtualization type and if it says container use nproc for cores and threads
I collected the outputs from other visualizers.
© 2023 GitHub, Inc.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник
RANDOM%0: division by 0 (error token is «0») about freenom-script HOT 1 CLOSED
Make sure at least one user agent string configured as uaString or just use default freenom.conf
- Cannot install — Error: Login failed, incorrect details HOT 1
- Error: config file not specfied when absolute path gived since #d5c9a61
- Error: config file not specfied when absolute path gived since #d5c9a61 HOT 1
- Option to modify the time period of renewal HOT 3
- Errors when listing or renewing domains HOT 1
- Error: Login token — failure (curl error code: 2) HOT 1
- Issue with the config file. HOT 4
- Not Updating IP HOT 1
- Cant update domains containing dashes HOT 3
- [Debug] Login failed in VPS
- Listing domains with renewal details results in sed error
- Forwarding A Domain HOT 1
- Social Sign-In HOT 4
- [Feature Request] Docker HOT 2
- Error: Domain details — httpcode 504 HOT 1
- How do I update DNS-Record for all domains HOT 1
- script cannot login to freenom if pw contains parentheses / special characters HOT 1
- How do I use update-all-domain feature with systemd-scheduling
- Freenom Domain Listing Error (Curl Error Code:28) HOT 1
Recommend Projects
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
TensorFlow
An Open Source Machine Learning Framework for Everyone
Django
The Web framework for perfectionists with deadlines.
Laravel
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
Recommend Topics
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
server
A server is a program made to process requests and deliver data to clients.
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Visualization
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
Recommend Org
We are working to build community through open source technology. NB: members must have two-factor auth.
Microsoft
Open source projects and samples from Microsoft.
Источник
Comments
tinogomes
pushed a commit
to tinogomes/ohmyzsh
that referenced
this issue
Sep 24, 2021
pranith
pushed a commit
to pranith/oh-my-zsh
that referenced
this issue
Oct 13, 2021
sudeeshjohn
pushed a commit
to sudeeshjohn/oh-my-zsh
that referenced
this issue
Nov 10, 2021
maojj
pushed a commit
to maojj/oh-my-zsh
that referenced
this issue
Jan 10, 2022
* officialorigin/master: style: use 24bit colors in Oh My Zsh logo if supported fix(cli): follow symlinks in plugin or theme completions fix(rust): fix `cargo` completion when sysroot contains spaces (#10571) fix(svn): fix output order in `svn_dirty_choose` (#10572) docs(vi-mode): fix link typo in readme (#10570) style: some code style fixes refactor(kubectl): optimize completion generation style: declare globals properly fix(kubectx): allow prompt sequences in `kubectx_mapping` (#10562) fix(ubuntu): fix `defining function based on alias` error (#10560) fix(bureau): fix `status` variable name causing error (#10561) fix(kubectx): quote % in `kubectx_prompt_info` fix(fossil): refactor `fossil_prompt_info` and quote % in branch fix(aws): quote % in `aws_prompt_info` fix: quote % in `box_name` prompt functions fix(bureau): quote % in git prompt function and remove global variables fix(trapd00r): fix potential command injection in `zsh_path` fix(agnoster): quote % in prompt functions fix(virtualenv): quote % in `virtualenv_prompt_info` fix(jenv): quote % in `jenv_prompt_info` fix(pyenv): quote % in `pyenv_prompt_info` fix(lib): quote % in `nvm_prompt_info` fix(lib): quote % in `git_remote_status` fix(svn): refactor and quote % characters in `svn_prompt_info` fix(svn): return true repo name in `svn_get_repo_name` fix(svn-fast-info): quote % characters in svn branch name fix(svn-fast-info): URL-decode svn branch name style(svn-fast-info): fix code style and `svn info` locale ci: disable GitHub Actions on forks chore: simplify project GitHub Action chore: simplify `GITHUB_TOKEN` env in project GitHub Action chore: I'm dumb af chore: let's try again chore: look ma no auth! chore: please work chore: fix auth in Project tracking Action chore: use GITHUB_TOKEN auth for Project Beta GitHub Action chore: add Projects Beta GitHub Action style(python): fix code style and some hidden bugs chore(python): minor corrections on README (#10548) docs(zsh-navigation-tools): remove installation steps from README (#10549) fix(systemd): enable `--user` on restart command (#10543) fix(rust): use default toolchain when completing `cargo` docs(nvm): clarify how to get Homebrew directory (#10393) docs(sudo): document key binding change chore(ubuntu): add documentation for `acsp` alias (#10325) feat(terraform): add more aliases (#9989) feat(terraform): add PREFIX and SUFFIX settings to `tf_prompt_info` (#8605) feat(python): add utilities to manage simple virtual environments (#9776) feat(python): add `pyserver` alias to start an HTTP server (#10217) perf(yarn): skip `yarn` call if default global bin directory exists (#10290) chore(bazel): update completion to f146202c feat(npm): toggle `npm install` / `npm uninstall` by pressing F2 twice (#9717) fix(pip): don't overwrite `requirements.txt` in internal commands (#10061) fix(pip): use `pip3` in `pip3 uninstall` completion (#10271) fix(git-prompt): fix clean prompt when stash is not empty (#9978) feat(debian): add `alu` alias for list and upgrade packages (#7928) chore(debian): document previous alias feat(debian): add `aar` alias for autoremove (#7869) feat(composer): add `cuh` alias for updating global packages (#6048) feat(composer): add `cs` alias for `composer show` (#10034) feat(common-aliases): add single-column and recursive `ls` aliases (#10096) feat(zbell): add option not to use notify-send (#10082) feat(vi-mode): add `INSERT_MODE_INDICATOR` (#9732) feat(transfer): allow encryption of uploads using GPG (#9983) fix(systemd): remove `sudo` from power-related aliases (#9441) feat(ruby): add new aliases `rrun` and `rserver` (#10218) feat(shell-proxy): support SOCKS protocol based on URI scheme (#10069) chore(ipfs): update completion script for IPFS version 0.8.0 (#9800) chore: add maintainer for `shell-proxy` plugin refactor(rvm): clean up `rb*` utilities definition and add more versions feat(rvm): add latest `rb*` utility functions (#9812) feat(repo): add command completion for repo 2.8 (#9388) feat(rake): support square brackets with rake binstub (#5361) fix(pass): update `pass` completion to ff5ac38 (#9761) feat(flutter): add a few more aliases (#9511) feat(ng): get `ng` completion from parsed help output (#10294) feat(macports): add commands to get list of updated ports (#8698) feat(helm): cache completion file in the background (#8326) feat(git-flow): add aliases for current `hotfix` branch refactor(git-flow): extract `git-flow` completion logic feat(git-flow): add aliases for current `feature` / `release` branch (#9439) feat(gcloud): support Homebrew Google Cloud SDK path (#9799) feat(fossil): add completion for `fossil add` (#8564) feat(fd): update fd completions (#9775) feat(ripgrep): update ripgrep completions (#9775) fix(fastfile): fix multiple bugs in plugin (#9574) refactor(emoji): rewrite script w/ Python and update emojis (#8069) feat(ember-cli): add completions for ember-cli (#5916) feat(drush): add Drupal 8 aliases to `drush` plugin (#9498) style(drush): fix code and README style style(acs): fix style and gitignore __pycache__ folder feat(bundler): add completion for `info` argument (#9594) feat(arcanist): add `arbl` and `arho` aliases (#6132) feat(autojump): add support for NetBSD (#9746) feat(ant): enable colored output by default (#6688) refactor(ant): extract completion function docs(aliases): clarify usage (#9990) docs(oc): update link to openshift CLI reference (#9667) feat(volta): add dynamic completion generation (#10515) feat(rbw): add completion for `rbw` Bitwarden client (#10346) feat(pip): alias `pip` to `pip3` if pip is missing (#10431) refactor(plugins): generate completion functions in the background chore: fix comment bulk replace refactor: handle `$0` according to the Zsh plugin standard (#10518) refactor(rust)!: merge `cargo` and `rustup` plugins into `rust` plugin (#10270) refactor(cargo): generate completion file in the background refactor(rustup): generate completion file in the background (#10392) fix(random): fix negated logic in `ZSH_THEME_RANDOM_QUIET` fix(gnu-utils): reassign GNU utils on `preexec` (#10535) fix(gnu-utils): always reapply GNU coreutils on `rehash` fix(installer): fix POSIX shell syntax of previous commit fix(installer): don't hard-code user `$HOME` directory on install refactor(golang): move completion out of the plugin fix(golang)!: rename `gop` alias to `gopa` to avoid conflict with Go+ (#10504) feat(golang): add aliases for `go tool` utility (#10361) feat(golang): add `gofx` alias for `go fix` (#10220) fix(random): fix `ZSH_THEME_RANDOM_QUIET` check (#10534) refactor(composer): improve completion and use official Zsh completion if available style(composer): fix code and README style fix(dirhistory): define key bindings for vi mode (#10450) feat(zsh-navigation-tools)!: update to zdharma-continuum fork (#10402) feat(lpass): add plugin for LastPass CLI completion (#9323) fix(symfony2): silence debug lines in command completion (#10528) feat(yarn): upgrade completion to latest version (#10516) feat(asdf): add support for archlinux/AUR package (#9893) fix(asdf): fix path to Homebrew installation of `asdf` (#10481) fix(cli): respect `ZDOTDIR` in plugin/theme change commands (#10520) fix(af-magic): add space before git and hg information (#9396) feat(brew): improve `brews` list layout (#10135) feat(rvm): add alias `rvms` (#10219) docs(README): Document .pre-oh-my-zsh (#10315) feat(operator-sdk): add plugin for operator-sdk (#10423) feat(jfrog): Support jf executable auto completion (#10503) feat(cnf): Added support for SUSE-derived operation systems (ZYpp) to CNF plugin (#10508) feat(istioctl): add plugin for istioctl (#10410) feat(volta): add volta plugin (#10441) feat(deno): adding drA alias for --allow-all (#10501) fix(heroku): fix XDG cache directory name and code style (#10436) feat(fzf): support fzf in Cygwin (#9463) refactor(fzf): adopt code style and simplify function naming (#10514) fix(jonathan): fix top bar alignment with RPROMPT fix(cli): fix plugin and theme suggestions in completion for older zsh versions fix: declare variables as global when using `typeset` style: use `typeset` for dynamic variable names feat(archlinux): add aliases for cleaning package cache (#10091) fix(ys): use default color instead of gray for improved readability (#10506) fix: quote % characters in ruby prompt info functions style(rbenv): adapt to code style style(chruby): fix plugin code style and loading process style(rbfu): clean up code refactor(themes): use `ruby_prompt_info` everywhere style(simonoff): fix code style and optimize use of variables fix(jonathan): fix theme for non-UTF8 locales style(jonathan): fix code style in jonathan theme fix(bira): fix color bleed in user_host prompt section (#10505) refactor(adben): simplify used variables and %-quote prompt functions fix(lib): %-quote git prompt functions refactor(shell-proxy)!: rename env vars to `SHELLPROXY_*` and add usage message (#10456) feat(afowler): add mercurial support style(afowler): simplify code and remove unnecessary variables style(af-magic): fix code style and remove unnecessary variables fix(mercurial): correctly check for untracked files in `hg_dirty` (#2177) perf(mercurial): optimize utility functions feat(mercurial): add `hgci` alias for interactive commit (#8912) feat(bira): improve theme and add support for mercurial (#6631) feat(mercurial)!: use `PREFIX` and `SUFFIX` settings in `hg_prompt_info` (#6631) perf(mercurial): improve performance of `hg_prompt_info` (#7929) fix(mercurial): show author name in `hgsl` alias log alias (#3500) chore: add ohmyzsh GitHub Sponsors to FUNDING.yml ci(spelling): turn off check-spelling action temporarily ci(spelling): automatically accept aliased commands (#10475) chore: update security docs and link to huntr.dev ci: add `check-spelling` action (#10470) feat(branch): show mercurial bookmarks if used (#9948) feat(updater): show command to update when update skipped (#10465) Revert "ci: add `check-spelling` GitHub Action" ci: add `check-spelling` GitHub Action chore: fix spelling errors across the project (#10459) chore: update new issue templates feat(cli): add `omz version` command feat(aws): Adds the login option for AWS SSO (#9921) feat(git): Add alias for rebasing to origin/main-branch (#10445) feat(dotnet): add alias for `dotnet build` command (#10435) feat(xcode): support `.swiftpm` as project file in `xc` (#10434) fix(lib): don't error if `INSIDE_EMACS` is not defined (#10443) fix(updater): stop update if `$ZSH` is not a git repository (#10448) style(bundler): simplify `bundled_commands` array operations fix(bundler): use BUNDLE_JOBS in `bi` to avoid config file change fix(bgnotify): avoid permission prompts by checking frontmost app ID (#10318) fix(docker-compose)!: check for old command instead of calling `docker` (#10409) fix(osx): deprecate `osx` plugin without symlink (#10428) feat(kn): add plugin for `kn` completion (#8927) feat(ssh-agent): add `quiet` option to silence plugin (#9659) fix(install): fix backslash in `printf` when showing logo (#10422) style(dirhistory): remove use of `eval` completely fix(themes): fix potential command injection in `pygmalion`, `pygmalion-virtualenv` and `refined` fix(plugins): fix potential command injection in `rand-quote` and `hitokoto` fix(lib): fix potential command injection in `title` and `spectrum` functions fix(dirhistory): fix unsafe eval bug in back and forward widgets fix(lib): fix `omz_urldecode` unsafe eval bug fix(dirhistory): fix Up/Down key bindings for Terminal.app fix(command-not-found): pass arguments correctly in Termux (#10403) fix(cli): avoid `git -C` for compatibility with git < v1.8.5 (#10404) fix(updater): avoid `git -C` for compatibility with git < v1.8.5 (#10404) refactor(updater): simplify check for available updates style(frontend-search): rename completion file to `_frontend` fix(cli): fix check for completion files in `omz plugin load` fix(emotty): fix glyphs output width in emotty theme feat(refined): allow selecting git branch by changing prefix to `:` (#10400) style: use `-n` flag in `head` and `tail` commands (#10391) feat(tmux): set session name with `ZSH_TMUX_DEFAULT_SESSION_NAME` (#9063) refactor(percol): fix style, bind keys for vi-mode and remove dependencies refactor(osx): Rename osx plugin to macos (#10341) fix(updater): stop update if connection unavailable docs: add Security Policy fix(command-not-found): pass arguments correctly in NixOS (#10381) feat(ys): increase color contrast with light color schemes (#10295) feat(dirhistory): support urxvt terminal key binding (#8370) fix(dirhistory): fix ALT+Up/Down key bindings for Terminal.app docs(dirhistory): document OPT key alternative for macOS and fix style fix(lib): fix `1` alias to `cd` to directory 1 in stack (#10370) chore: fix grammar mistake in `CONTRIBUTING.md` (#10362) feat(xcode): support `Package.swift` as project file in `xc` (#10358) feat(fzf): support getting fzf from nix-darwin (#10355) fix(changelog): fix for `${(@ps:$sep:)var}` construct in zsh < 5.0.8 fix(changelog): fix percent escapes in `printf` calls perf(changelog): use regex-match instead of `sed` to parse commit subjects fix(changelog): go back to ignoring commits from merged branches perf(changelog): use a single `git log` command to get all commit messages feat(mix): update `mix` commands and descriptions (#10273) fix(changelog): don't show more than 40 commits (#10345) fix(cli): exit `omz update` with correct error code (#10342) fix(ssh-agent): fix check for running `ssh-agent` process with hidepid /proc (#8492) feat(osx): add `freespace` command to clean purgeable disk space (#8762) fix(ruby)!: rename aliases that start with `g` to `ge` feat(ruby): add multiple `gem` aliases (#9005) Swapping gh with ghlp as 'gh' is reserved for the Github CLI. #9005 docs(README): document new `zstyle` update settings (#10304) feat(updater): add support for terminal hyperlinks feat(obraun): display time with leading zeros (#10289) fix(ssh-agent): fix for bad `zstyle` command argument feat(ssh-agent): allow lazy-loading SSH identities (#6309) feat(mvn): support using `mvnw` in multi-module projects (#9413) fix(lib): fix `diff --color` argument check for BSD systems (#10269) fix(git): fix directory parse from URL in `gccd` (#10276) fix(lib): fix status exit code check in `git_prompt_status` (#10275) feat(git): add `gswm` and `gswd` aliases (#9897) fix(battery): force battery percentage as integer fix(battery): fix system check so Termux uses the correct method feat(battery): add support for Android via Termux (#9752) fix(battery): support `acpitool` and multiple batteries under Linux (#9609) Revert "fix(changelog): don't parse commits of ignored types" feat(yarn): add global bin directory to `$PATH` (#9410) feat(sublime): add support for Sublime Text 4 on Windows (#10063) chore: zshrc update settings rewording feat(z): update z to latest version (#10267) fix(git)!: rename `gdu` alias to `gdup` (#10263) fix(changelog): don't parse commits of ignored types chore(chucknorris): add a few more Chuck Norris quotes (#10210) refactor(chucknorris): refresh plugin code fix(gpg-agent): correctly overwrite `$SSH_AUTH_SOCK` and other improvements (#7059) fix(docker-compose): fix for slow `docker compose` call on remote Docker contexts (#10264) fix(jsontools): fix broken conditional in zsh 5.0.2 (#10262) fix(cli): fix zsh array syntax for szh 5.0.2 fix(init): rename function `f` due to clash with `f` alias (#10260) feat(git): add `gccd` alias to clone and cd into git repository (#8220) fix(per-directory-history): fix use of global history on shell start (#9008) feat(cli)!: add `omz reload` command and deprecate `zsh_reload` plugin (#9078) docs(python): update README to include new `py` alias (#9995) feat(mercurial): add `hg log` aliases (#9979) feat(yarn): add `ylnf` alias to fix linting problems (#9219) feat(yarn): update completion from zsh-completions (73505e4) feat(docker-compose): update completion (4fa72a0, 2021-01-19) fix(docker-compose): support Compose V2 `docker compose` command (#10248) feat(updater): check if there are updates before prompting (#8387) feat(updater): add mode to only remind you to update when it's time (#10187) refactor(updater): change auto-update settings to use `zstyle` feat(git): run `gitk` in the background in `gk` and `gke` aliases (#9657) feat(init): show error and process tree if OMZ is loaded from non-zsh shells (#10234) fix(pyenv): fix pyenv-virtualenv detection under macOS. feat(cli): show current theme in `omz theme list` fix(half-life): fix prompt color bleeding and code clean up (#10085) fix(cli): get branch and tags from OMZ folder in `omz changelog` completion feat(juju): add plugin for Juju (juju.is) (#10075) feat(lib): don't correct `su` command arguments (#10214) fix(lib): fix automatic title abort inside Emacs (#10124) fix(emacs): correctly pass arguments to emacsclient when $2 is stdin fix(emacs): assess if there are open frames of the expected type refactor(emacs): simplify emacsclient wrapper code refactor(emacs): remove dependency on `require_tool.sh` and clean up code style refactor(archlinux)!: remove `yaourt` support (#9713) fix(osx): only run Preview.app in `man-preview` if man page exists (#10222) fix(init): detect and abort on non-zsh shell execution of Oh My Zsh docs(vi-mode): document `$KEYTIMEOUT` issue (#9588) fix(init): fix `division by 0` error (#10213) style(installer): use rainbow logo and polish success message (#10211) refactor(vim-interaction): clean up code and open gvim instance if none open (#10209) Revert "feat(archlinux): add cleanup aliases to `yaourt` and `yay` (#10184)" feat(lib): allow setting custom completion dots sequence (#9424) refactor(django)!: deprecate plugin in favor of Zsh's django completion feat(update): allow updating from branch set up on install feat(jsontools): add tools to pretty print json-lines (ndjson) (#10176) refactor(jsontools): move to functions, align `is_json` tool to return exit code refactor(jsontools): restructure and simplify logic feat(lando): add support for `php` command (#10146) docs(kubectx): fix README sample code syntax (#10199) feat(archlinux): add cleanup aliases to `yaourt` and `yay` (#10184) fix(update): silence `typeset` calls in `upgrade.sh` script (#10048) feat(golang): add `goga` alias to install dependencies in current directory, recursively (#7786) feat(golang): add `gota` to test current directory recursively (#8974) style(core): make alternative cache directory equivalent to Arch Linux package fix(core): use `$HOME/.cache` if default cache dir is non-writable (#10193) refactor(plugins): remove old generated completion files fix(core): move plugin-generated completion files to `$ZSH_CACHE_DIR/completions` fix(plugins): fix `_comps` error in completion generation plugins (#10190) fix(docker): remove unwanted asterisk in completed docker commands Revert "feat(ssh-agent): only start ssh-agent once (#5359)" fix(copybuffer): define CTRL+O binding for all keymaps (#6442) fix(cp): add unique suffix to rsync backup directory for each user (#10170) fix(vim-interaction): look up the newest GVim instance (#9095) feat(git): add `gdu` alias to diff against upstream (#8721) fix: automatically create completion for `cargo` and `rustup` plugins (#10087) chore(changelog): fix first-letter uppercase in breaking change messages feat(changelog): print BREAKING CHANGE messages in a prettier way feat(git-auto-fetch): add date to git-auto-fetch log file (#10021) fix(git-auto-fetch): cancel fetch if we don't have permission over git folder (#10010) fix(git)!: rename `git mergetool` aliases to `gmtl*` (#9154) feat(changelog): change style of `BREAKING CHANGES` header fix(chruby): fix typo in test for Homebrew path (#9887) feat(autojump): add new Homebrew default path on M1 Macs (#9637) feat(gcloud): add Mac M1 Homebrew path (#10143) feat(git): change from commiter to author in `git log` aliases (#9670) fix(pyenv): do not warn if PYENV_ROOT is undefined (#10162) feat(pyenv): don't load pyenv-virtualenv with `ZSH_PYENV_VIRTUALENV=false` feat(pyenv): silence bad config warning with `ZSH_PYENV_QUIET=true` fix(pyenv): properly load pyenv shims and warn of broken configuration feat(git): guess main branch name also from remotes (#10158) fix(frontend-search): fix codepen.io search (#10157) fix(sudo): allow different $EDITOR settings and fix zsh-syntax-highlighting redraw style(sudo): apply main style guide indentation feat(ssh-agent): allow specifying absolute path to `identities` fix(git): fix `gbda` alias when there are no merged branches (#10005) refactor(ssh-agent): clean up and reorganize code feat(ssh-agent): only start ssh-agent once (#5359) feat(ssh-agent): allow using external helper to ask for passwords (#7631) feat(mlh): let users configure the official MLH theme (#9997) fix(kubectx): show plain context if not mapped (#10134) fix(suse): avoid refresh attempts for Zypper queries (#9798) feat(cli): add `theme set` subcommand to change theme in .zshrc style(cli): print usage messages to stderr fix(pyenv): fix for checking if pyenv-virtualenv is installed docs(pyenv): document necessity to logout after PATH settings fix(lib): fix clipboard copy on Termux fix(updater): fix reset ANSI escape code for resetting underline format style(cli): fill rows in column output in theme and plugin `list` commands refactor(cli): extract substitution awk script in `plugin disable` fix(cli): fix multiple errors in `plugin disable/enable` feat(cli): add subcommands for plugin `enable` and `disable` (#9869) fix(colemak): remove `lesskey` usage in less v582 and newer (#10102) docs(dirhistory): document keyboard shortcut conflict with Windows Terminal fix(changelog): also display commits from merged branches style(extract): adopt main code style guide and refactor variables fix(extract): don't push entries to dirstack when extracting rpm and deb files fix(extract): correctly extract rpm files on other directories feat(extract): add cpio support fix(extract): support unpacking deb file from different directory feat(extract): add suport for .cab files via `cabextract` refactor(cloudapp)!: remove deprecated `cloudapp` plugin refactor(go)!: remove deprecated `go` plugin refactor(fedora)!: remove deprecated `fedora` plugin feat(cli): add `plugin load` subcommand (#9872) refactor(lib): refactor take functions feat(lib): add `mkcd` as equivalent to `takedir` (#9749) feat(plugins): `octozen` shows an Octocat zen quote on startup (#5959) feat(plugins): add completion plugin for `invoke` (#7311) feat(git): add `develop` branch name detection (#9881) chore(ag): fix README (#10001) fix(pyenv): fix for ignoring pyenv-win commands fix(pyenv): fix pyenv PATH settings with a warning (#9935) feat(plugins): add fnm plugin (#9864) chore(github): add links to supported tools (#10057) chore: convert the repo issue templates to issue forms (#10050) fix(aws): allow for profile switch w/o MFA configured (#9924) fix(copybuffer): show error below the command line feat(gnu-utils): include ggrep in gcmds (#10044) fix(update): fix error exit code on update check (#10033) fix(dotenv): draw confirmation prompt in next empty line feat(changelog): ignore merge commits fix(lib): remove `kubectx` stub prompt function from lib Revert "ssh-agent: improvements (#6309)" refactor(git-glow): Add config interpolation for git-flow messages (#7481) feat(git): Add aliases for 'git commit -S -s [-m]' (#7616) feat(pm2): Adding a pm2 plugin (#7684) feat(supervisor): Add aliases for supervisor (#5819) perf(mercurial): speed up mercurial plugin (#4591) feat(nvm): introduce customizable list of command that triggers lazy loading (#9946) feat(zoxide): add new plugin for zoxide (a smarter cd CLI tool) (#9950) feat(git): Add alias for 'git checkout --recurse-submodules' (#9958) feat(pip): add alias for updating all requirements via pip (#9965) style(mlh): update the official theme of Major League Hacking (#9971) feat(kubectx): adding a new plugin for 'kubectx' (#6114) style(kubectl): Being more explicit alias to the main CLI tool instead of to another alias (#6567) feat(plugins): Add Ag completion (#3534) feat(plugins): New plugins for samtools and bedtools (#3574) feat(plugins): Plugin "debian": Switch order of "apt" and "aptitude" for detection (#7533) feat(supervisord): autocomplete for restart command (#5144) feat(plugins): Add helper function to get current mercurial bookmark (#4970) feat(plugins): Add a new showpkg alias to ubuntu plugin (#4653) feat(plugins): Add new isodate plugin for friendly date formatting commands (#9963) feat(plugins): add gpr alias for /git pull -rebase/ which is easier to remember (#9964) feat(take): add support to `take' for taking remote urls (#2029) feature(plugins): add bower commands aliases (#3387) fix(plugins): cache thefuck aliases (#5522) fix(virtualenvwrapper): several changes for checking git directory, including fixes (#5663) fix(kubectl): remove duplicated alias for kubectl plugin `kgsa` (#9927) feat(rails): Add `rdmr` (`rake db:migrate:redo`) alias to Rails plugin (#6124) feat(rails): Add `rdmd` and `rdmu` aliases to Rails plugin (#6126) feat(rails): add 'rails server --bind' alias (#4977) fix(vagrant): Allow dot in Vagrant box name (#4803) fix(update): correct description of how changelog is displayed (#9943) Aliases: Adding a README file for the plugin. #4662 feat(plugins): add aliases cheatsheet plugin (#4662) ssh-agent: improvements (#6309) add python alias (#7736) feat(extract): add support for .ear files (#9901) chore(chucknorris): fix typo (#9916) fix(gentoo): fix the color of the prompt symbol (#9885) fix(dirhistory): fix ALT+Left/Right key bindings for iTerm2 (#9940) feat(dirhistory): add ALT+UP/DOWN key bindings for iTerm2 (#8502) feat(shrink-path): add ability to toggle off path shrinking (#9794) feat(git): add aliases `gcas` and `gcasm` for commit with sign-off (#8881) fix(cargo): complete flags for default cargo aliases (#9692) fix(command-not-found): remove invalid argument for PackageKit (#9876) feat(plugins): add `gh` plugin for GitHub CLI (#9557) fix(deno): actually load deno completion (#9863) fix(kubectl): use `--current` flag in `kcn` alias (#7605) chore: fix "Facebook" typo in README.md (#9378) feat(plugins): add plugin for `deno` (#9847) feat(npm): add aliases for `npm search` and `npm info` (#9365) feat(npm): add alias for `npm update` (#9442) feat(npm): add alias for `npm i -f` (#8454) feat(fzf): look in XDG compliant location (#9858) feat(systemadmin): add IPv6 info to `geteip` command (#9856) feat(ys): add virtualenv prompt info (#8453) feat(ys): add setting to hide dirty info in hg repositories (#8415) fix(gentoo): fix tab color completion (#9810) docs(rails): reflect changes to aliases (#9809) feat(command-not-found): add support for Termux (#9666) refactor(command-not-found): clean up and reorganize logic feat(command-not-found): add support for Homebrew on Apple M1 (#9797) feat(archlinux)!: remove deprecated commands `aur` and `abs` (#9803) feat(react-native): add aliases for iPhone 12 (#9792) chore: direct support queries to Discussions chore: I'm dumb chore: fix CONTRIBUTING.md TOC docs: document commit convention in CONTRIBUTING.md chore: add maintainer for archlinux plugin feat(archlinux): add support for aura AUR helper (#9467) feat(shell-proxy): enable unexported `DEFAULT_PROXY` setting (#9774) refactor(archlinux): fix name & scripts; reorder aliases (#9546) feat(theme_chooser): display non-zero exit code (#8428) fix(dirhistory): make sure to call built-in zle widgets (#9771) fix(git): add `push` or `save` to `gstu` alias (#9766) refactor(adben): refactor theme and degrade gracefully on missing dependencies (#9734) fix(virtualenv): allow empty prefix/suffix in prompt function (#9763) feat(plugins): add hitchhiker plugin (#5117) fix: use `$USERNAME` guaranteed to always be defined in zsh refactor(installer): fix static analysis warnings (#9529) fix(vi-mode): fix keymap indicator on zle-line-finish (#9620) fix(fossil): PROMPT and RPROMPT are no longer exported (#9655) feat(ssh-agent): add `ssh-add-args` setting (#7908) feat(fzf): add support for Termux package (#9718) fix(emotty): fix `bad assignment` error (#9714) feat(git): add `grbo` alias for `git rebase --onto` (#8088) fix(uninstall): fix renaming .zshrc when no original rc file found feat(gentoo)!: use `vcs_info` to support other VCSs (#9440) fix(terraform): use faster method to get workspace (#9709) fix(update): don't error on upgrade no-op (#9685) feat: add mongocli plugin (#9248) [docker-compose] Added alias for docker-compose up --build (#8843) Replce 'rake routes' task with 'rails rotues' (#9662) refactor(git-flow): remove duplicate `gflfp` alias (#9640) refactor(gallois): clean up theme and fix typos docs(git-prompt): explain stashed icon (⚑) (#9619) fix(updater): refresh date of last update only on successful update Bump year to 2021 fix(vi-mode): ignore `clip*` function errors in yank and put widgets feat(essembeh): update theme with new features (#9595) feat(plugins): add `zbell` plugin to notify when commands end (#3034) feat(plugins): add `term_tab` plugin to complete other zsh sessions' directories (#3018) fix(debian): add quotes to `kclean` alias (#3066) fix(lib): use -N syntax in `head` and `tail` to support Solaris (#6391) feat(git-prompt): display stash count in prompt feat(git-prompt): display untracked files count chore: caution against `COMPLETION_WAITING_DOTS` in template (#8352) fix(colorize): bypass less aliases in `colorize_less` (#9593) feat(last-working-dir): log separate `lwd`s for different SSH keys on the same user account (#9534) feat(macports): add 'reclaim' to completion list for Macports (#9521) fix(jake-node): support all Jakefile filenames in `jake` completion (#9589) fix(changelog): fix spacing in breaking changes message fix(universalarchive): make plugin zsh-only to fix `realpath` not found error fix(lib): update Emacs terminal detection in `title` function (#9577) fix(changelog): display scope in breaking change messages fix(CLI): show symlinked themes in `omz theme list` chore: add Konfekt as universalarchive maintainer feat(plugins): add `universalarchive` plugin to conveniently compress files (#6846) fix(vi-mode)!: add back edit-command-line key binding as 'vv' (#9573) fix(vi-mode): hide cursor-change logic behind `VI_MODE_SET_CURSOR` setting docs(vi-mode): revamp README and document settings fix(archlinux): update URL and key server in `pacmanallkeys` (#9569) feat(CLI): add `plugin info` subcommand (#9452) refactor(vi-mode): remove duplicate bindkey logic and fix syntax fix(vi-mode): control cursor, restore and use visual mode and speed up mode changes (#8004) docs(nvm): clarify how to enable settings (#9542) fix(lib): mark changes as MODIFIED on 'MM' in `git_prompt_status` (#9552) feat(git): add grst alias for `git restore --staged` (#8932) feat(docker): update completion to upstream version (#9470) fix(CLI): properly get zsh command in `omz update` (#9558) feat(grc): source `grc.zsh` instead of hard-coding its content (#9553) fix(changelog): remove CR characters in breaking change messages fix(brew)!: update `bcubc` alias to use `brew upgrade --cask` (#9501) fix(updater): don't pipe changelog to less when updating fix(genpass): use `log()` instead of `log2()` for zsh < 5.6 (#9548) chore: update git-lfs maintainer handle fix(genpass): improve performance and usability and fix bugs (#9520) fix(genpass): add compatibility for macOS paste command fix(genpass): warn if no wordlist is found fix(genpass): check for presence of shuf command. fix(genpass): fix grep regex in `genpass-xkcd` for FreeBSD version (#9514) fix(genpass): only use words with ASCII characters in `genpass-xkcd` (#9508) fix(changelog): allow breaking change message to span multiple lines feat(updater): save version prior to updating so `omz changelog` just works™ feat(plugins): add genpass plugin with 3 distinct password generators (#9502) fix(composer): autoload `_cache_invalid` for antigen compatibility chore!: notify breaking change in `git_prompt_info` feat(lib): show upstream branch in `git_prompt_info` (#9188) refactor(hanami): change global aliases and clean up README Document fd alias change in README fd: Rework command to be more idiomatic feat(plugins): add grc plugin for Generic Colouriser (#9315) fix(git): silently fail in `git_main_branch` if not in a git repo (#9484) chore: add Josh Medeski as `wp-cli` plugin maintainer refactor(archlinux): prevent leaking local variables (#9476) feat(wp-cli): add aliases for DB management (#9469) feat(lib)!: soft-deprecate `upgrade_oh_my_zsh` function for everybody fix(changelog): fix assoc array syntax for zsh 5.4.2 and older (#9495) fix(updater): don't show changelog when running unattended update (#9495) fix(command-not-found): show error in Ubuntu when no package is found (#9418) fix(changelog): fix highlight of codeblocks in subject feat(CLI): add `--unattended` flag to `omz update` to not reload zsh (#9187) fix(updater): properly show changelog via `less` fix(git-prompt): make `gitstatus.py` python3-compatible (#9186) fix(updater): fix ignored variable name in read fix(updater): make sure to run it with zsh feat(CLI): add `omz changelog` command feat(updater): add changelog display by parsing the commit list fix(updater): correctly restart the zsh session when the update pulled changes refactor(updater): switch to Zsh execution and fix git remote detection logic fix(git-auto-fetch): background `git-fetch-all` and other fixes (#9468) fix(magic-enter): fix various bugs in the plugin (#9466) style(ansible): minor style change (#8356) feat(terraform): add autocompletion for Terraform 0.13 (#9226) fix(shell-proxy): change NAME env variable for WSL clash (#9447) feat(gitfast): update to git-completion 1.2 (#9458) feat(aws): respect optional parameters from the AWS CLI config file (#9453) refactor(colored-man-pages): move nroff wrapper and refactor logic in `colored` function (#9437) feat(git): support trunk branches in `git_main_branch` (#9417) feat(sudo): support aliases to $EDITOR (#9431) docs(aws): add config examples (#9422) fix(aws): fix acp function for MFA without role and other fixes (#9426) docs(thefuck): add description for enabling the plugin (#9433) fix(battery): use `pmset` for battery percentage in macOS (#9364) fix(installer): fix error message if $ZSH exists when installing fix(lib): make opts local in omz_urlencode to fix scoping bug fix(fzf): consistently ignore .git directory in `FZF_DEFAULT_COMMAND` (#9421) Revert "lib: remove share_history" fix(aws): support MFA for profiles without role to assume (#9411) aws: split setting profile from changing profile (#9402) Add maintainer for aws plugin aws: get and set session token if available (#9397) colorize: add compatibility for zsh < 5.1 (#9400) Fix labels in issue templates gitfast: fetch latest fixes from git-completion (#9390) lib: delete zsh session history list aws: add role delegation and MFA support as per IAM Best Practices (#8419) gitfast: improve command aliases (#9385) gitfast: update to latest upstream and more (#9382) npx: deprecate plugin Grammar: remove hyphens from predicate adjective “up to date” (#9356) kubectl: add aliases for serviceaccount, daemonsets and cronjob (#9344) Revert "lib: treat _ and - as part of a word" fzf: add check for OpenSUSE and OpenBSD packages (#9327) lib: follow symlinked plugins in `plugin list` CLI command lib: allow bare output in theme and plugins list command lib: use `column` to format plugin and theme list CLI commands kubectl: check for empty cache completion file kubectl: verify kubectl is installed before running compdef (#9346) globalias: use ${(z)var} to split into words using shell parsing globalias: expand filtering to anywhere in the command (#9338) safe-paste: fix _bracketed_paste_zle_init/finish error git-prompt: document Python prerequisite in README (#9336) meta: add checklist instructions on Pull Request template Add gitpod integration globalias: allow filtering values not to be expanded (#9331) emacs: add ansi-term directory tracking (#9218) systemadmin: correct sort order for psmem aliases (#6253) agnoster: fix icon for unstaged git status (#9164) lib: fix regex bug in git_prompt_status lib: remove share_history lib: fix `omz help` and reword lib: fix fmt removing ESC characters in theme and plugin list CLI commands Add lando plugin (#8748) mvn: list modules (directories with pom.xml) (#8478) mvn: add Quarkus support in mvn completion (#9037) wd: update to v0.5.1 (#9273) nvm: add autoloading of nvm version in .nvmrc nvm: exit the plugin if the nvm loading script wasn't found nvm: only lazy-load nvm if the NVM_LAZY setting is set nvm: speed-up nvm loading with `--no-use` nvm: check $XDG_CONFIG_HOME/nvm for an nvm installation nvm: simplify nvm.sh and bash completion loading nvm: use `nvm current` in nvm_prompt_info and look in alternate install locations lib: fix formatting in `omz pr clean` CLI command lib: add plugin and theme subcommands and fix `omz pr clean` Fix performance drop of iterating over lines and other stuff git_prompt_status now uses hash lookups instead of multiple greps lib: hide git_prompt_status when hide-status is set safe-paste: refresh plugin (update for zsh 5.1 and vi keymaps) (#7887) Add git-lfs plugin (#9077) lib: follow standards in window title (#9320) kubectl: add wrappers for colorized output in JSON and YAML (#9316) nvm: add Homebrew's nvm setup (#8316) z: upgrade plugin to the latest version (#9310) Revert "Remove redundant bashcompinit calls" fino: stop bold with prompt sequence fino: fix dangling "using" and clean up (#9307) git: fix version check git: run gfa with --jobs=10 (fetch remotes in parallel) (#9268) bundler: refactor bundler plugin and clean up gem wrappers bundler: format aliases table and clean up README (#9300) Add completion plugin for IPFS (InterPlanetary File System) (#4737) Add sublime-merge plugin (#7228) pip: move plugin cache to XDG folder (#9299) Remove redundant bashcompinit calls terraform: add tf Alias (#8206) minikube: fix spelling (#9270) lib: support simple terminal in title function composer: autoload cache functions lib: support alacritty $TERM in title function brew: add alias for brew to avoid upgrading casks (#9280) bgnotify: use $2 in preexec hook if $1 is empty lib: correct :q syntax in title function for clarity Fix image alignment Right-align table in README A few README tweaks laravel5: clean up agnoster: allow disabling AWS prompt with SHOW_AWS_PROMPT=false lib: clean up zsh_stats function avit: reenable use of $fg instead of prompt sequence colors to fix weird bug random: add ZSH_THEME_RANDOM_QUIET setting docker: document option-stacking setting Remove racially-charged language from the codebase brew: replace deprecated brew cask outdated command (#9253) docs: fix small typo in README (#9255) meta: change support label meta: change feature label pyenv: run pyenv init with --no-rehash (#8917) wd: update to latest version (v0.5.0) (#9244) update: return git error code on failure (#9238) fzf: setup FZF_DEFAULT_COMMAND based on installed tools (#8895) sublime: add Sublime Text 4 path for macOS common-aliases: lazily assign $BROWSER, $EDITOR and $XIVIEWER in ext aliases lib: treat _ and - as part of a word init: define $ZSH if not defined Add sponsor button fishy: fix one-level directory bug and bad array assignment in zsh 5.0.1 Remove perl dependency chuck-norris: remove some CN quotes and fix formatting (#9220) pygmalion: use pure zsh instead of perl (#9210) vagrant-prompt: replace `grep -P` call with sed and clean up scd: update to 1.4.0 (#9066) zsh_reload: use $SHELL to reload zsh only if it's a zsh shell (fixes #9054) sudo: keep space before the command to ignore it in the history (#9178) Update README with new update command (#9203) Remove missing screenshots from kube-ps1 README docs: document oneline argument passing to install script docs: add fetch install command for FreeBSD (#9172) meta: don't apply support label on bug reports Remove zsh session restart on omz update and upgrade_oh_my_zsh Fix upgrade_oh_my_zsh function deprecation Underline links in install and update script aliases: Don't overshadow fd lib: remove CTRL-Backspace key binding altogether meta: add ISSUE_TEMPLATE config.yml lib: remove CTRL-Backspace binding for vi keymaps wd: fix permissions wd: update to latest version cli: add update command (#9094) lib: bind to all keymaps when COMPLETION_WAITING_DOTS is set lib: add CTRL-backspace and CTRL-delete to delete whole words lib: bind keys to viins and vicmd keymaps and clean up file pyenv: ignore $PATH pyenv if on WSL Remove non-existing %p prompt sequence from themes lib: substitute COMPLETION_WAITING_DOTS for ellipsis pipenv: toggle pipenv shell on startup colorize: add $ZSH_COLORIZE_CHROMA_FORMATTER config env var (#8824) rbenv: fix current_gemset lib: support mlterm-256color aws: improve check for aws_completer - unhardcode path (#9123) battery: add acpi requirement to README (#9116) extract: add IPA to extractable filetypes (#9117) git: go back to previous main branch detection logic timer: threshold to show timers only for time-consuming commands (#8151) docker-compose: add alias for `docker-compose kill` (#8997) kubectl: add alias to list pods by namespace (#8604) httpie: add alias for https (#8032) update: prefix rm call with command in trap (#9107) Fix self check link vscode: add support for VSCodium (#9080) git: change docs for git_main_branch git: better algorithm to decide what's the main branch dotenv: add never option to confirmation prompt (#9102) yarn: add alias for upgrade-interactive to the latest version (#8764) mix-fast: add decriptions to mix-fast completions (#8561) git: use `master` if it exists, otherwise use `main` aws: allow @ in AWS profiles (#9099) lib: safety fix and speed-ups for git.zsh prompt functions (#7804) lib: prefix diff call with command to bypass diff aliases sudo: make the behavior more in line with expectations (#9047) Edit for better consistency in template (#8593) Bug and Feature Request Templates + MLH Theme + Readme (#9068) cli: beauty touches on 'omz pr test' command git: change main branch naming scheme (#9049) lib: enable diff color (#8807) agnoster: fix git working tree check (#9072) install: fix typo (#9069) gradle: force `--console plain` for tasks cache generation (#8731) spacing changed Handle unset variables in various parts of the codebase (#8944) encode64: fix typo in README (#9052) Modernize install and update banners (#9045) update: change dash in function name for sh compat (fixes #9064) update: only update on a valid affirmative input (#9062) Add new mvn alias for `mvn fmt:format` (#9053) archlinux: fix pacweb breaking when multiple packages found (#9059) core: add title support for mlterm (#8303) Deprecate cloudapp plugin (fixes #8966) init: don't run update check if DISABLE_AUTO_UPDATE (#9040) osx: refactor plugin and add a few features (#9026) init: run update check in the same zsh process (#9019) Change Discord invite URL muse: clean up theme web-search: add Google Scholar (#9014) web-search: allow custom search engines update: refactor and fix logic in check_for_upgrade.sh (#8939) smt: fix time since last commit logic Updating the README.md peepcode: add virtualenv prompt and fix git calls chucknorris: normalize apostrophes (#9013) chucknorris: fix typos (#9012) Updating some gem command reference chucknorris: remove duplicate quotes Silence non-existent/empty dir errors in fastfile_{sync,ls} lib: don't override bigger HISTSIZE and SAVEHIST values (#8993) wd: update to latest version (#8530) web-search: add Wayback Archive (#8784) init: reapply hack for invalid ZSH_COMPDUMP filenames (b8761985) fino-time: fix virtualenv prompt by escaping dollar sign (#8991) init: oops init: use grep for zcompdump metadata check Add deprecation notice for fedora and go plugins. Remove git-remote-branch and nyan plugins (deprecated) Fix load of various plugins: fastfile, keychain, sfffe, stack virtualenvwrapper: fix load and detection logic jenv: fix Homebrew install path bug introduced in #7541 brew: remove completion deprecation notice and fix README kube-ps1: update to latest version (ede8098) Add `shell-proxy` plugin (#8692) Add plugin for bazel completion (#6434) Add plugin for LXD autocomplete (#7457) terraform: add fmt -recursive flag autocompletion (#8880) python: add line-number to pygrep (#8867) rbenv: fix redirect in current_gemset asdf: fix completions if ASDF_DIR is already exported (#8538) git: add alias for git diff excluding lock files (#8935) docker: update to latest upstream completion (92dc906) (#8835) archlinux: fix pacweb with non-English locales (#8916) vagrant: fix vagrant box autocomplete (#8929) avit: fix $reset_color sequence in prompt Use oh-my-zsh path variables in zshrc.zsh-template (#8960) common-aliases: fix hardcoded .zshrc path (#5926) git: clarify what the glp alias does (#8850) fino-time: fix git and ruby prompt sequences direnv: check if direnv is installed (#8809) forklift: add support for Forklift distributed via the Setapp (#8803) git: add convenience aliases for `git apply` and `git am` (#8563) git: exclude devel branch from list in gbda alias (#8957) af-magic: account for active conda envs in dash line man: look for man page for subcommands (#8798) core: remove inc_append_history option (#8048) git: exclude 'development' in gdba alias (#8902) jira: add tempo command (#8928) pipenv: fix error when Pipfile is not a file (#8931) Revert "core: enable hist_reduce_blanks" Prefix cd calls with `builtin` (#8937) frontend-search: add packagephobia (#8908) update: fix bug in upgrade.sh: s/NORMAL/RESET/ (#8947) bundler: add alias for bundle add bundler: add alias for bundle check (#5000) update: display logo in rainbow colors (#8941) core: enable hist_reduce_blanks Add plugin for rustup completion (#8914) zsh-navigation-tools: update to 5937e57e composer: fix documented aliases composer: add aliases for 'outdated' commands composer: use cache to fix slowness during startup core: fix zstyle definition of use-cache pygmalion: revert multiline prompt change magic-enter: define bindkey for vi mode as well init: silence zcompdump metadata write for invalid ZSH_COMPDUMP filenames gitfast: proper synchronization (#8550) core: fix cmp invocation in BSD systems core: refresh zcompdump cache file in init script (#8878) core: move core folder to lib, for now core: add basic Oh My Zsh CLI (#8876) sdk: support completion of new commands in 5.8.0 (#8870) meta: add Ross Goldberg as owner of the sdk plugin sdk: improve sdkman completion (#8854) aws: fix aws_change_access_key function with awscli v2 (#8816) jsontools: correct usage for is_json (#8857) autojump: clarify need to install it first meta: basic CODEOWNERS file (gitfast plugin) composer: fix cdo alias due to command api change (#8828) tig: add more info in README (#8818) battery: revert battery charging symbol 1-character-width hack lib: speed up slow parts of the lib files; other small fixes themes: fix minor syntax error gnu-utils: append make to cmds (#8794) colorized-man-pages: add hooks for dman and debman commands (#8776) battery: remove printf usage where possible battery: fix Full battery bug on Linux; force 1-char-width on charging symbol nebirhos: use short hostname in prompt keychain: define SHORT_HOST if not defined systemd: remove newline from systemd prompt (#8772) git: fix markdown in README (#8769) history-substring-search: fixing my dumb mistake history-substring-search: update to upstream version 2019-05-12 themes: change lstheme function to themes in $ZSH_CUSTOM in any level dotenv: add agree-once improvement to confirmation prompt (#8729) virtualenvwrapper: look in $HOME/.local/bin directory (#8758) direnv: change direnv to not assume path (#8757) Add direnv plugin (#8666) update path for snapd /snap/bin/* which is used by Linux systems (#8752) man: use only first element of command before prepending man (#8747) taskwarrior: update completion to latest version (dcdf712) autoenv: look in additional installation locations, redo logic Clean up plugin READMEs and a few plugins z: add markdown Readme (#8715) updater: use hardcoded color sequences instead of tput updater: use `git config` instead of `git -c` for git < v1.7.2 archlinux: fix wrong parameters in pacfiles alias (#8712) sdk: remove invalid value "candidates" from sdk flush completion (#8725) gradle: use upstream completion and fix some other stuff aws: fix awscli completion path on NixOS (#8707) nvm: add `install-latest-npm` to completion (#8709) phing: fix copy-paste error in README lib: support konsole* $TERM in title function (#8035) aws: add support for AWS CLI v2 autocompletion (#8670) shrink-path: added glob and quote options (#7694) arcanist: add functions which allow copy-pasting of URLS (#8688) rbenv: fix rbenv_prompt_info prefix and suffix (#3764) knife: fix refactor mistake knife: improve knife-solo support in completion (#3315) kube-ps1: update to latest upstream version (c685ac8) lib: clean up termsupport.zsh Use $jobstates and $jobtexts to look for jobs git: make the gpristine alias remove untracked git repos (#8697) lib: use `command` to run rm in upgrade function (#8696) random: remove random theme from possible themes to choose from Some tweaks to the Jira plugin Clean up jira function Better support for branch name Uppercase the issue in open issue command in the JIRA plugin sdk: add support for local versions and optimize sed calls (#7870) python: add pyuserpaths function (#7758) command-not-found: speed up call to Homebrew command-not-found (#7740) shrink-path: add minimum length and ellipsis symbol options (#7382) minikube: cache command completions (#7446) pip: add local Python package files to completion (#7442) lib: use grep-alias cache only if ZSH_CACHE_DIR is writable Document ZSH_THEME_RANDOM_BLACKLIST setting Refactor grep.zsh file Fast algorithm to determine grep alias flags Performance enhancement for lib/grep Ignore .tox folder in grep Also set options for egrep and fgrep Exclude .idea folder from grep search scope Add git version requirement in documentation updater: fix --autostash argument. Works for git > 1.7.1 zsh_reload: respect `$ZDOTDIR` when searching for `.zshrc` (#7706) gitignore: add newline to `gi` output (#7586) mercurial: add hga alias to README (#7547) mix: add format option to completion (#7256) gradle: fix command option name in completion (#6586) pass: update completion to upstream version (675a002e) (#6475) fasd: cache full fasd initialisation script (#6097) stack: use builtin completion command (#6230) lib: urlencode hostname in update_terminalapp_cwd (#6245) composer: keep composer autocompletion when using global (#5933) kitchen: change sed regex in completion to capture all commands (#5820) lib: add support for clippaste in WSL using powershell geeknote: update completion (#4986) fancy-ctrl-z: ensure widgets are called with full context (#4838) lib: add termux commands to clipboard.zsh (#6243) lib: add support for clip.exe clipboard copy in WSL Fix an issue with escape characters (#7979) ng: refactor README macports: add rdeps and rdependents completion (#4717) jhbuild: add some missing commands and update README (#5195) jhbuild: add shell alias (#3707) norm: add hg prompt (#6725) nmap: add alias for ICMP scan (#4807) python: add alias to run the proper IPython based on virtualenv updater: add --autostash to git pull (#7172) vagrant: document aliases zsh-interactive-cd: add vi-mode support (#8681) installer: add option to install without replacing .zshrc (#8209) npm: hardcode completion function and delete cached one (#8679) battery: remove redundant grep calls in battery_pct function avit: fix prompt sequence (fixes #8678) Add JFrog CLI plugin (#8250) battery: fix floating point output in macOS installer: remove redundant cp command (#8668) lib: delete upgrade lock in upgrade_oh_my_zsh vscode: add documentation for running in macOS (#8674) Add blacklist variable for random theme Polish themes plugin and error out if theme not found Add themes in $ZSH_CUSTOM to the pool of candidates Move random theme functionality into "random" theme avit: add years since last commit if appropriate avit: clean up theme code avit: replace custom prompt functions with OMZ ones agnoster: fix bzr prompt with breezy installed (#8646) systemd: add prompt function to show systemd units' status (#7657) af-magic: fix virtualenv prompt suffix git: add `grename` to rename a local branch and in the origin remote (#8622) af-magic: fix dashed separator sizing and refactor web-search: add wolframalpha search engine (#8638) arcanist: document aliases arcanist: add `arc diff --create` alias (#8610) dotnet: use official dotnet completion (#8518) git: add alias for git stash --include-untracked (#8617) cloudapp: fix copy-paste mistake in README (#8629) fzf: support for NixOS and Void Linux (#8618) kubectl: avoid conflict with existing f aliases in kca alias (#8625) dotenv: fix prompt newline dotenv: add ZSH_DOTENV_PROMPT config (#8624) gradle: run gradle command instead of alias (#8620) Add zsh-interactive-cd plugin dotenv: prompt before executing dotenv file (#8606) Remove invalid batteries (#8275) Report only active battery (#4726) Various syntax fixes and function naming equivalence Clean up Linux battery commands and syntax Fix calculation for battery percentage (#4774) lib: load bash completion functions automatically jump: fix for `marks' and CTRL+G key binding jump: add support for directories starting with a dot (#4661) jump: fix issues in plugin and document CTRL+G key binding vagrant: obey VAGRANT_CWD when completing vagrant commands (#7219) Detect dependency plugins in candy-kingdom and kiwi themes Add dotnet watch and dotnet watch run (#8612) common-aliases: fix loading of is-at-least function (#6215) systemadmin: fix header line sorting in pscpu (#6167) lib: add git function to determine repository name (#4989) kube-ps1: add example for common pitfall (#8318) systemd: refactor and add latest commands (#6250) Update issues and PR templates (#8471) virtualenvwrapper: rewrite init script location code (#8521) Revert "fix: Update tmux plugin to use modern terminfo. (#8582)" af-magic: fix showing aws prompt out of the box (#8243) Link to Actions page in GitHub Action badge Rename GitHub Action to CI fix: Update tmux plugin to use modern terminfo. (#8582) aws: fix array assignment in asp function lol: fix docs for yolo alias (#8576) vscode: use insiders build if stable not found (#8568) Create Github Action to run tests (#8569) virtualenvwrapper: fix finding script on Ubuntu 19.10 (#8451) init: force use of builtin test in is_plugin colored-man-pages: force `env` command (#8551) yarn: use zsh-completions latest version (493984e) lib: add MSYS2 support to clipboard integration (#8542) pyenv: only run if pyenv not in $PATH (#8462) extract: add lz4 support (#8510) Bump license year (#8512) -mAdd hitokoto plugin (#8422) Laravel artisan commands extension (#8425) Add kubectl all-namespaces aliases for k8s objects (#8434) Add kubectl log since aliases (#8448) Feature/add dotnet plugin (#8503) Added MicroK8s plugin for ZSH (#8499) extract: add lrz support (#8500) Feature/ionic plugin aliases (#8494) New alias zwip that launch cucumber with the :wip profile (#4111) Plugins: repo - add more aliases. (#3917) osx: use return instead of exit in spotify function osx: fix exit on quit command in spotify function (#8504) Relocating chat/twitter codeclimate: add README otp: add README and use clipcopy Rename some plugin READMEs for consistency tmux-cssh: add README svn-fast-info: add README, reorg. plugin sfffe: add README rbfu: add README paver: add README knife_ssh: small tweaks knife_ssh: add README knife: add README and reformat completion file gnu-utils: add README, simplify plugin glassfish: add README gas: add README fastfile: add README colorize: update plugin to support less options (#8392) Rewrite gitstatus collection to be more robust (#7322) Update link for Pygments Change order of automatic virtualenv activation/deactivation (#6687) yarn: add alias for yarn lint (#8481) fzf: add support for FreeBSD (#8474) fasd: fix plugins name in README (#8483) extract: add tar.lz support (#8479) extract: add zstd support (#8469) arcanist: clarify README (#8461) keychain: pass host as argument to keychain (#8436) sbt: use new sbt command naming convention (#8426) fzf: change debian completion file path (#8402) Mention FAQ in the README (#8051) Fix change to old shell on uninstall (#8430) tmux: add ZSH_TMUX_UNICODE to README tmux: add support for forced unicode support (#5166) lol: fix yolo alias using https URL Fix non-POSIX conditional syntax Remove current directory from sys.path in python invocations (#8408) Actions to take after repository migration is complete (#8394) jenv: only add to PATH if not already on it (#8414) colorize: update Pygments download link (#8407) terraform: update completion (#8396) Replace "restart shell" documentation "exec zsh" (#8411) Use safer append to hook function arrays (#8406) rails: fix rendering issue in README (#8410) extract: add RPM archive support (#8347) git-auto-fetch: stop plugin from asking for ssh-key passphrase (#8399) Add Twitter follow badge to README Add Discord badge to README Echo to Error-Stream. Double quote to prevent globbing and word splitting. Update default color to 'emacs' which both chroma & pygmentize support Fix issue recognizing if tools are insalled Fix some comments and messages. Remove (probably) debug messages. Improve ZSH_COLORIZE_TOOL recognition. osx: modify itunes function to support Apple Music (#8372) Update README.md Add support for chroma tmux: export ZSH_TMUX_CONFIG again to provide to tmux (#8390) osx: fix exit on unknown command in spotify function (#8375) tmux: fix bad tmux config syntax and logical expression error in 86b39cf (#8374) upgrade: remove double whitespace in message (#7517) extract: keep *.gz files with pigz and gunzip tmux: allow to define a custom configuration path (#7606) Upgrade some URLs to HTTPS (#8202) Remove line below copyright so that GitHub shows LICENSE details emacs: support BSD mktemp in emacsclient.sh (#8351) Fix badly resolved rebase conflict Clean up ignore submodules logic in parse_git_dirty Add an option about git submodules to ignore fasd: add README (#8334) fabric: fix awk "return not in function" error in completion alias-finder: fix wc numeric conditional (#8251) python: fix and extend pyclean (#7762) powder: add README (#8310) Fix order and reword some things mvn: add autocompletion for openliberty (#8244) Fix target_list creation. Supports fabric 1 and 2 Add profiles documentation swiftpm: update completion for Swift 5.1 (#8248) Set default git-config values known to fix repository issues rbenv: add README (#8293) safe-paste: add README (#8292) cargo: update completion to latest version (cdac4a8) magic-enter: update README (#8284) Clean up README Reorganize stuff Format docker Readme like the other plugins. Add Readme.md for supervisor. Sync completion with original source. rails: detect gems.rb in _rake_command (#8223) bundler: support new file naming convention (#6594) pass: add README (#8282) phing: add README (#8278) eecms: add README (#8277) bundler: make it play nice with functions that call wrapped commands (#8271) lib: allow alias expansion in _ sudo alias (#8268) fzf: fix regression (#8269) bira: move virtualenv information (#8266) git-remote-branch: add README (#8259) screen: add README (#8256) rake: add README (#8254) meta: remove automatic bug label on bug reports fzf: check for dpkg before checking for fzf in debian Update README Added README for pod Delete alias section add readme for the rust plugin emotty: add README (#8240) fbterm: add README (#8241) battery: add support for sysctl in FreeBSD (#8155) python: add recurse flag to pygrep (#8217) Reword and add extra information git-escape-magic: fix typos in README (#8234) Change description sprunge: add README and refactor (#8239) singlechar: add README (#8232) terminalapp: delete plugin deprecated since 2015 (#8230) yarn: add yarn version alias (#8138) yarn: use zsh-completions latest version (87e1313) Adds chruby plugib README.md yarn: add ytc alias for test with coverage (#7664) gradle: support gdub completion (#6135) Create README.md for compleat plugin cloudapp: add README (#8229) Add READMEs for tugboat and colemak plugins (#8207) Reword virtualenvwrapper: add README (#8226) Add README for pow and powify plugins (#8225) pyenv: add README (#8224) Some syntax changes and more function docs Small changes mysql-macports: add README (#8210) dash: simplify completion logic Remove redundant section and document keyword args docs: add README.md for Dash plugin Create README.md Create README.md Update README.md Create README.md terminitor: add README (#8197) rebar: add README (#8198) n98-magerun: add README (#8200) Adding README for rvm cakephp3: add README (#8196) yii: add README (#8194) Add rubocop to bundler readme Add rubocop to bundled_commands sublime: ignore wslpath errors if C drive is missing yarn: add yd as yarn dev alias (#7663) jruby: add README (#8190) Update README: include Yarn workspace shortcuts Update README with up-to-date platform requirements lein: add README (#8189) Add README for thor and pip plugins (#8185) oc: add README (#8188) autoenv: add README (#8184) Fix table alignment react-native: add aliases for newer iPhones to Doc react-native: add aliases for newer iPhones Add flutter plugin (#8150) gcloud: add search path for Arch Linux (#8164) Add gcloud plugin (#8144) Fix WSL check for WSL 2 and simplify nohup in open_command robbyrussell: restore prompt spacing (#8148) z: update to latest version (e77e938) git: fix gtl alias argument kube-ps1: add a note where to put the `PROMPT=...` line (#8142) installer: allow chsh to work in termux Unquote yes in conditional expressions for style consistency gitfast: update completions (#8130) ssh-agent: check if `ssh-add -l` was successful robbyrussell: remove local variable (#8131) Change description for Evan's theme to something neutral (#6304) Update syntax on the remaining functions Updated git-prompt.sh to quote variables meta: remove PR triage GitHub action :cry: Fix bad function definitions in Debian plugin wd: point to the correct directory even if installed with antibody (#8116) git-escape-magic: fix typo (#8113) autojump: fix loading when autojump is not in $PATH (#8074) ripgrep: update completion to latest version (#8083) homestead: repair sed regex (#8103) plugins/git: Fix `gbda` trying to delete worktree branches ubuntu: fix aglu to list available upgrades (#8082) feature: add condition for regular expression git: add aliases for git switch and restore (#8089) af-magic: add hg prompt and tweak virtualenv info (#8056) lib: delete LC_CTYPE locale setting which causes problems fabric: support fabric 2…
cmoore
pushed a commit
to cmoore/oh-my-zsh
that referenced
this issue
Apr 28, 2022
tekniklr
pushed a commit
to tekniklr/oh-my-zsh
that referenced
this issue
Sep 6, 2022
Bash command line exit codes demystified
Posted: February 4, 2020 |
More Linux resources
When you execute a command or run a script, you receive an exit code. An exit code is a system response that reports success, an error, or another condition that provides a clue about what caused an unexpected result from your command or script. Yet, you might never know about the code, because an exit code doesn’t reveal itself unless someone asks it to do so. Programmers use exit codes to help debug their code.
Note: You’ll often see exit code referred to as exit status or even as exit status codes. The terms are used interchangeably except in documentation. Hopefully my use of the two terms will be clear to you.
I’m not a programmer. It’s hard for me to admit that, but it’s true. I’ve studied BASIC, FORTRAN, and a few other languages both formally and informally, and I have to say that I am definitely not a programmer. Oh sure, I can script and program a little in PHP, Perl, Bash, and even PowerShell (yes, I’m also a Windows administrator), but I could never make a living at programming because I’m too slow at writing code and trial-and-error isn’t an efficient debugging strategy. It’s sad, really, but I’m competent enough at copying and adapting found code that I can accomplish my required tasks. And yet, I also use exit codes to figure out where my problems are and why things are going wrong.
Exit codes are useful to an extent, but they can also be vague. For example, an exit code of 1 is a generic bucket for miscellaneous errors and isn’t helpful at all. In this article, I explain the handful of reserved error codes, how they can occur, and how to use them to figure out what your problem is. A reserved error code is one that’s used by Bash and you shouldn’t create your own error codes that conflict with them.
Enough backstory. It’s time to look at examples of what generates error codes/statuses.
Extracting the elusive exit code
To display the exit code for the last command you ran on the command line, use the following command:
The displayed response contains no pomp or circumstance. It’s simply a number. You might also receive a shell error message from Bash further describing the error, but the exit code and the shell error together should help you discover what went wrong.
Exit status 0
An exit status of 0 is the best possible scenario, generally speaking. It tells you that your latest command or script executed successfully. Success is relative because the exit code only informs you that the script or command executed fine, but the exit code doesn’t tell you whether the information from it has any value. Examples will better illustrate what I’m describing.
For one example, list files in your home directory. I have nothing in my home directory other than hidden files and directories, so nothing to see here, but the exit code doesn’t care about anything but the success of the command’s execution:
The exit code of 0 means that the ls command ran without issue. Although, again, the information from exit code provides no real value to me.
Now, execute the ls command on the /etc directory and then display the exit code:
You can see that any successful execution results in an exit code of 0, including something that’s totally wrong, such as issuing the cat command on a binary executable file like the ls command:
Exit status 1
Using the above example but adding in the long listing and recursive options ( -lR ), you receive a new exit code of 1:
Although the command’s output looks as though everything went well, if you scroll up you will see several «Permission denied» errors in the listing. These errors result in an exit status of 1, which is described as «impermissible operations.» Although you might expect that a «Permission denied» error leads to an exit status of 1, you’d be wrong, as you will see in the next section.
Dividing by zero, however, gives you an exit status of 1. You also receive an error from the shell to let you know that the operation you’re performing is «impermissible:»
Without a shell error, an exit status of 1 isn’t very helpful, as you can see from the first example. In the second example, you know why you received the error because Bash tells you with a shell error message. In general, when you receive an exit status of 1, look for the impermissible operations (Permission denied messages) mixed with your successes (such as listing all the files under /etc , as in the first example in this section).
Exit status 2
As stated above, a shell warning of «Permission denied» results in an exit status of 2 rather than 1. To prove this to yourself, try listing files in /root :
Exit status 2 appears when there’s a permissions problem or a missing keyword in a command or script. A missing keyword example is forgetting to add a done in a script’s do loop. The best method for script debugging with this exit status is to issue your command in an interactive shell to see the errors you receive. This method generally reveals where the problem is.
Permissions problems are a little less difficult to decipher and debug than other types of problems. The only thing «Permission denied» means is that your command or script is attempting to violate a permission restriction.
Exit status 126
Exit status 126 is an interesting permissions error code. The easiest way to demonstrate when this code appears is to create a script file and forget to give that file execute permission. Here’s the result:
This permission problem is not one of access, but one of setting, as in mode. To get rid of this error and receive an exit status of 0 instead, issue chmod +x blah.sh .
Note: You will receive an exit status of 0 even if the executable file has no contents. As stated earlier, «success» is open to interpretation.
I receiving an exit status of 126. This code actually tells me what’s wrong, unlike the more vague codes.
Exit status 127
Exit status 127 tells you that one of two things has happened: Either the command doesn’t exist, or the command isn’t in your path ( $PATH ). This code also appears if you attempt to execute a command that is in your current working directory. For example, the script above that you gave execute permission is in your current directory, but you attempt to run the script without specifying where it is:
If this result occurs in a script, try adding the explicit path to the problem executable or script. Spelling also counts when specifying an executable or a script.
Exit status 128
Exit status 128 is the response received when an out-of-range exit code is used in programming. From my experience, exit status 128 is not possible to produce. I have tried multiple actions for an example, and I can’t make it happen. However, I can produce an exit status 128-adjacent code. If your exit code exceeds 256, the exit status returned is your exit code subtracted by 256. This result sounds odd and can actually create an incorrect exit status. Check the examples to see for yourself.
Using an exit code of 261, create an exit status of 5:
To produce an errant exit status of 0:
If you use 257 as the exit code, your exit status is 1, and so on. If the exit code is a negative number, the resulting exit status is that number subtracted from 256. So, if your exit code is 20, then the exit status is 236.
Troubling, isn’t it? The solution, to me, is to avoid using exit codes that are reserved and out-of-range. The proper range is 0-255.
Exit status 130
If you’re running a program or script and press Ctrl-C to stop it, your exit status is 130. This status is easy to demonstrate. Issue ls -lR / and then immediately press Ctrl-C:
There’s not much else to say about this one. It’s not a very useful exit status, but here it is for your reference.
Exit status 255
This final reserved exit status is easy to produce but difficult to interpret. The documentation that I’ve found states that you receive exit status 255 if you use an exit code that’s out of the range 0-255.
I’ve found that this status can also be produced in other ways. Here’s one example:
Some independent authorities say that 255 is a general failure error code. I can neither confirm nor deny that statement. I only know that I can produce exit status 255 by running particular commands with no options.
Wrapping up
There you have it: An overview of the reserved exit status numbers, their meanings, and how to generate them. My personal advice is to always check permissions and paths for anything you run, especially in a script, instead of relying on exit status codes. My debug method is that when a command doesn’t work correctly in a script, I run the command individually in an interactive shell. This method works much better than trying fancy tactics with breaks and exits. I go this route because (most of the time) my errors are permissions related, so I’ve been trained to start there.
Have fun checking your statuses, and now it’s time for me to exit.
[ Want to try out Red Hat Enterprise Linux? Download it now for free. ]
Источник
Деление на ноль
В этом треде делим на ноль
Стабильный кде 4.4
Нет, ну в самом деле сегодня поржал от матюков человека обновившегося до 4.4. Теперь он на гноме.
$ python
Python 2.5.4 (r254:67916, Nov 19 2009, 22:14:20)
[GCC 4.3.4] on linux2
Type «help», «copyright», «credits» or «license» for more information.
Traceback (most recent call last):
File « », line 1, in
ZeroDivisionError: float division
Вообще, если определить деление на ноль как [lim k/x при x->0], где k — некоторое действительное число, то получаем в итоге бесконечность. Итак, k/0 = inf.
:$bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty’.
1/0
Runtime error (func=(main), adr=3): Divide by zero
Мда, в моей Теории Деления на Ноль загвоздочка. Легко обходим ее, объявляя k!=0.
ПС. Вообще это шутка была, если че.
Почему нельзя делить на ноль?
«Делить на ноль нельзя!» — большинство школьников заучивает это правило наизусть, не задаваясь вопросами. Все дети знают, что такое «нельзя» и что будет, если в ответ на него спросить: «Почему?» А ведь на самом деле очень интересно и важно знать, почему же нельзя.
Всё дело в том, что четыре действия арифметики — сложение, вычитание, умножение и деление — на самом деле неравноправны. Математики признают полноценными только два из них — сложение и умножение. Эти операции и их свойства включаются в само определение понятия числа. Все остальные действия строятся тем или иным образом из этих двух.
Рассмотрим, например, вычитание. Что значит 5 – 3? Школьник ответит на это просто: надо взять пять предметов, отнять (убрать) три из них и посмотреть, сколько останется. Но вот математики смотрят на эту задачу совсем по-другому. Нет никакого вычитания, есть только сложение. Поэтому запись 5 – 3 означает такое число, которое при сложении с числом 3 даст число 5. То есть 5 – 3 — это просто сокращенная запись уравнения: x + 3 = 5. В этом уравнении нет никакого вычитания. Есть только задача — найти подходящее число.
Точно так же обстоит дело с умножением и делением. Запись 8 : 4 можно понимать как результат разделения восьми предметов по четырем равным кучкам. Но в действительности это просто сокращенная форма записи уравнения 4 · x = 8.
Вот тут-то и становится ясно, почему нельзя (а точнее невозможно) делить на ноль. Запись 5 : 0 — это сокращение от 0 · x = 5. То есть это задание найти такое число, которое при умножении на 0 даст 5. Но мы знаем, что при умножении на 0 всегда получается 0. Это неотъемлемое свойство нуля, строго говоря, часть его определения.
Такого числа, которое при умножении на 0 даст что-то кроме нуля, просто не существует. То есть наша задача не имеет решения. (Да, такое бывает, не у всякой задачи есть решение.) А значит, записи 5 : 0 не соответствует никакого конкретного числа, и она просто ничего не обозначает и потому не имеет смысла. Бессмысленность этой записи кратко выражают, говоря, что на ноль делить нельзя.
Самые внимательные читатели в этом месте непременно спросят: а можно ли ноль делить на ноль? В самом деле, ведь уравнение 0 · x = 0 благополучно решается. Например, можно взять x = 0, и тогда получаем 0 · 0 = 0. Выходит, 0 : 0=0? Но не будем спешить. Попробуем взять x = 1. Получим 0 · 1 = 0. Правильно? Значит, 0 : 0 = 1? Но ведь так можно взять любое число и получить 0 : 0 = 5, 0 : 0 = 317 и т. д.
Но если подходит любое число, то у нас нет никаких оснований остановить свой выбор на каком-то одном из них. То есть мы не можем сказать, какому числу соответствует запись 0 : 0. А раз так, то мы вынуждены признать, что эта запись тоже не имеет смысла. Выходит, что на ноль нельзя делить даже ноль. (В математическом анализе бывают случаи, когда благодаря дополнительным условиям задачи можно отдать предпочтение одному из возможных вариантов решения уравнения 0 · x = 0; в таких случаях математики говорят о «раскрытии неопределенности», но в арифметике таких случаев не встречается.)
Вот такая особенность есть у операции деления. А точнее — у операции умножения и связанного с ней числа ноль.
Ну, а самые дотошные, дочитав до этого места, могут спросить: почему так получается, что делить на ноль нельзя, а вычитать ноль можно? В некотором смысле, именно с этого вопроса и начинается настоящая математика. Ответить на него можно только познакомившись с формальными математическими определениями числовых множеств и операций над ними. Это не так уж сложно, но почему-то не изучается в школе. Зато на лекциях по математике в университете вас в первую очередь будут учить именно этому.
Источник
(Read 7646 times)
0 Members and 3 Guests are viewing this topic.
Ha, cheers, those pesky assumptions again.
Logged
‘lite-tweaks-super’ returning the following error:
:~/$ lite-tweaks-super
/usr/bin/lite-tweaks-super: line 812: ((: PERCENTAGE = 100 * 1 / 0 : division by 0 (error token is «0 «)The ‘while read line’ loop should not in theory at least by the looks execute any iterations if ‘$TOTAL_LINES’ is zero, my scripting is largely POSIX (blame BSD) and not Bash so off the top of my head I’m not entirely sure what is going on here:
## Arrays execution
run_icon=/usr/share/icons/Faenza/actions/32/system-run.png
x=0
for k in «${!ARRAYC
- }»; do x=$(( $x + 1 )); done # Get the total number of selected items in the array
TOTAL_LINES=$x
printf ‘%s n’ «${ARRAYC
- }»|
while read line
do
$line # Execute functions one by one
if [ $? = 1 ]; then
zenity —info —title=» Lite Tweaks» —text=»Error:n${line}»
fi
let i++
(( PERCENTAGE = 100 * ${i} / ${TOTAL_LINES} ))
echo «$PERCENTAGE»if [ «$PERCENTAGE» == «100» ]; then
echo «#Done»
sleep 1
fidone| zenity —progress —width=320 —window-icon=»$run_icon» —pulsate —no
Looks to me you are calling lite-tweaks-super instead of lite-tweks. Call lite-tweaks instead which is the one that passes all arrays to lite-tweak-super when needed.
Logged
‘lite-tweaks-super’ returning the following error:
:~/$ lite-tweaks-super
/usr/bin/lite-tweaks-super: line 812: ((: PERCENTAGE = 100 * 1 / 0 : division by 0 (error token is "0 ")
The ‘while read line’ loop should not in theory at least by the looks execute any iterations if ‘$TOTAL_LINES’ is zero, my scripting is largely POSIX (blame BSD) and not Bash so off the top of my head I’m not entirely sure what is going on here:
## Arrays execution
run_icon=/usr/share/icons/Faenza/actions/32/system-run.png
x=0
for k in "${!ARRAYC}"; do x=$(( $x + 1 )); done # Get the total number of selected items in the array
TOTAL_LINES=$x
printf '%s n' "${ARRAYC}"|
while read line
do
$line # Execute functions one by one
if [ $? = 1 ]; then
zenity --info --title=" Lite Tweaks" --text="Error:n${line}"
fi
let i++
(( PERCENTAGE = 100 * ${i} / ${TOTAL_LINES} ))
echo "$PERCENTAGE"
if [ "$PERCENTAGE" == "100" ]; then
echo "#Done"
sleep 1
fi
« Last Edit: March 27, 2017, 11:13:56 AM by Tegid »
Logged
I have the following example, and I cannot see why.
line 48: 15.111111111 -2.55555: syntax error: invalid arithmetic operator (error token is ".111111111 -2.55555")
This is my source in ksh:
export a=2.55555
export b=15.111111111
export c=$(( $b -$a))
echo $c
Does someone have an idea please ?
muru
189k52 gold badges460 silver badges711 bronze badges
asked Jan 19, 2021 at 16:18
4
You code is valid in ksh (although it is not necessary to export
the variables, unless you plan on using them in a child environment). So for example given
$ cat myscript.ksh
#!/usr/bin/env ksh
export a=2.55555
export b=15.111111111
export c=$(( $b -$a))
echo $c
then
chmod +x myscript.ksh
$ ./myscript.ksh
12.555561111
However most other common shells do not support non-integer arithmetic — based on the error message it looks like you are actually executing the code with bash
:
$ bash ./myscript.ksh
./myscript.ksh: line 5: 15.111111111 -2.55555: syntax error: invalid arithmetic operator (error token is ".111111111 -2.55555")
answered Jan 19, 2021 at 18:40
steeldriversteeldriver
127k21 gold badges226 silver badges311 bronze badges
1
ksh has floating point support, so ksh was not used?
Bash
doesn’t do decimals in $(( ... ))
,
i.e. floating point numbers cannot be used.
One can look up the relevant section in man bash
-manual by typing
/^ARITH
ENTER
Well there you will see:
«Evaluation is done in fixed-width integers with no check for overflow, though division by 0 is trapped and flagged as an error.»
As @Terrance says in a comment above:
export c=$(echo "$b - $a | bc)
should work.
answered Jan 19, 2021 at 17:08
HannuHannu
4,3851 gold badge21 silver badges37 bronze badges
2