サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
コーヒー沼
mywiki.wooledge.org
Note: The FAQ was split into individual pages for easier editing. Also, for faster loading of this page, the answers are no longer presented here in their entirety. Readers, click the [BashFAQ/nnn] link at the bottom of each answer to read the rest of the answer. Editors, click the '[edit]' link at the bottom of each entry. Don't add new ones to this page; create a new subpage with the next availa
Bash Pitfalls This page is a compilation of common mistakes made by bash users. Each example is flawed in some way. 1. for f in $(ls *.mp3) One of the most common mistakes BASH programmers make is to write a loop like this: for f in $(ls *.mp3); do # Wrong! some command $f # Wrong! done for f in $(ls) # Wrong! for f in `ls` # Wrong! for f in $(find . -type f) # Wrong! for f in `find . -type f` # W
Why doesn't set -e (or set -o errexit, or trap ERR) do what I expected? set -e was an attempt to add "automatic error detection" to the shell. Its goal was to cause the shell to abort any time an error occurred, so you don't have to put || exit 1 after each important command. This does not work well in practice. The goal of automatic error detection is a noble one, but it requires the ability to t
What is the difference between test, [ and [[ ? The open square bracket [ command (aka test command) and the [[ ... ]] test construct are used to evaluate expressions. [[ ... ]] works only in the Korn shell (where it originates), Bash, Zsh, and recent versions of Yash and busybox sh (if enabled at compilation time, and still very limited there especially in the hush-based variant), and is more pow
I'm trying to put a command in a variable, but the complex cases always fail! Variables hold data. Functions hold code. Don't put code inside variables! There are many situations in which people try to shove commands, or command arguments, into variables and then run them. Each case needs to be handled separately. For the simple case in bash, you can use an array to store arguments to pass to a co
I set variables in a loop that's in a pipeline. Why do they disappear after the loop terminates? Or, why can't I pipe data to read? In most shells, each command of a pipeline is executed in a separate SubShell. Non-working example: # Works only in ksh88/ksh93, or zsh or bash 4.2 with lastpipe enabled # In other shells, this will print 0 linecount=0 printf '%s\n' foo bar | while IFS= read -r line d
The File Transfer Protocol (FTP) is specified in RFC 959, published in October 1985. The attempt in this specification is to satisfy the diverse needs of users of maxi-hosts, mini-hosts, personal workstations, and TACs, with a simple, and easily implemented protocol design.That's from the introduction. Does anyone here know what a TAC is? I don't. I had to look it up, since the acronym wasn't even
How to make bash scripts work in dash This page is an attempt to list some of the most common bashisms, i.e. features not defined by POSIX (won't work in dash, or general /bin/sh). It probably won't be exhaustive. Note also we talk about "bashism" because this wiki is largely bash-centric but a number (almost all) of these extensions work in at least some other shells like ksh or zsh with perhaps
Commands and Arguments -> Introduction You are invited to make additions or modifications so long as you can keep them accurate. Please test any code samples you write. All the information here is presented without any warranty or guarantee of accuracy. Use it at your own risk. When in doubt, please consult the man pages or the GNU info pages as the authoritative references. About This Guide A new
このページを最初にブックマークしてみませんか?
『EnglishFrontPage - Greg's Wiki』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く