Introduction
This repository retrieves logs that are output when an error occurs in a command while executing a shell script.
Commands that need to be installed
- git
Quick Start
If you have already installed the above command, run the following command to download from the repository, then change directory and run the shell script to display the errors output by the command.
Ubuntu
Output results
hello shellscript
ls: unrecognized option `--false'
Try 'ls --help' for more information
Macos
MacPorts
Output results
hello shellscript
ls: unrecognized option `--false'
usage: ls [-@ABCFGHILOPRSTUWabcdefghiklmnopqrstuvwxy1%,] [--color=when] [-D format] [file ...]
Windows
WSL2
Output results
hello shellscript
ls: unrecognized option `--false'
Try 'ls --help' for more information
MSYS2 MINGW64
Output results
hello shellscript
ls: unknown option `--false'
Try 'ls --help' for more information
Execution steps
Ubuntu
Click to open details
Prior confirmation
Enter the following command into your terminal. If you don’t get a “command not found” message, then it’s OK.
preinstall
If the command you see as “command not found” in your terminal, please install it using the following command.
command
Running the following command in your terminal should output a string similar to the details shown.
Detail
hello shellscript
ls: unrecognized option `--false'
Try 'ls --help' for more information
Macos
Click to open details
Prior confirmation
If you enter the following command into the terminal and you don’t get a “command not found” message, then it’s OK.
*macOS uses the MacPorts package manager to manage commands. If you haven’t installed it yet, please see the MacPorts installation instructions at the link below. Also, you can set aliases for commands so that they can be called without conflicting with your existing environment. If this is your first time using this blog, please refer to the following two articles to set up your environment.
preinstall
If you encounter a “command not found” error in the terminal, install the command using the following command and then set up an alias for it.
command
Running the following command in the terminal should output a string similar to the details shown.
Detail
hello shellscript
ls: unrecognized option `--false'
usage: ls [-@ABCFGHILOPRSTUWabcdefghiklmnopqrstuvwxy1%,] [--color=when] [-D format] [file ...]
Windows
Click to open details
Prior confirmation
If you enter the following command into the prompt and you don’t get a “command not found” message, then it’s OK.
WSL2
MSYS2 MINGW64
*This has been tested on Windows using WSL2 and MSYS2 MINGW64. Please install WSL2 if possible. If you are unable to set it up, you can install MSYS2, but some commands may only work with WSL2. Please refer to the article below for instructions on how to install WSL2 and MSYS2.
preinstall
If you see a “command not found” error in the prompt, please install the command using the following command.
WSL2
MSYS2 MINGW64
command
Executing the following command at the prompt should output a string similar to the details shown.
WSL2
Detail
hello shellscript
ls: unrecognized option `--false'
Try 'ls --help' for more information
MSYS2 MINGW64
Detail
hello shellscript
ls: unknown option `--false'
Try 'ls --help' for more information
Afterword
By writing `>>` and `2>>` after a command, you can separate standard output and error output. The `2` in `2>>` is a file descriptor; when an error occurs, a string is output, so using `2>>` allows you to append the error output to the file specified in the subsequent argument.