0 oy
1 görüntülenme
önce (220 puan) tarafından

It's just a slim alteration from the above one-ocean liner. If you're playacting roughly with strange directory/filenames, checking the production with both ls and readlink is informative, as ls wish yield "simplified" paths, subbing ? Too note, in constrast to the [ program, [[ is indeed a special, "reserved" word in the shell's syntax (it's a bash extension, not standardized in POSIX sh). But it's only recognized as a special word if it's the first word in a command. In your example, the [[ occurs later in the command and so will be parsed as a normal argument, literally the string "[[" and be passed as part of the argument list to the invocation of the [ program. In the sample code you provided the command that you're passing to if is [, which is also sometimes known as test. It is this command which takes the switches you're asking about. In bash the test command will be a built-in command; try type [ to learn its type.
More useful still is the -f switch which evaluates to true if the following argument exists and is a regular file (as opposed to a directory or a block device, or whatever). In bash these are implemented via temp files, usually in the form /tmp/sh-thd., while in dash they are implemented as anonymous pipes. This can be observed via tracing system calls with strace command. Replace bash with sh to see how /bin/sh performs this redirection. Connect and share knowledge within a single location that is structured and easy to search. The Best Buy Virtual Store has hundreds of Blue Shirt experts ready to answer your questions and help you shop. It’s easy, all you have to do is connect with one of our tech experts via chat, video or audio call on BestBuy.com or through the Best Buy App. As the commands such as realpath or readlink could be not available (depending on the operating system).
As some find lines like if test -f filename; then foo bar; fi, etc. annoying, there is also a program called [ which is in fact a symlink to the test program. When test is called as [, it expects to find ] as an additional terminating argumentation - this sentence structure is made up by the exam computer program and brawl is not mindful of it at whole. The followers hand reads from a file named "testonthis" communication channel by parentage and and so compares to each one credit line with a uncomplicated string, a draw with exceptional characters and buy xanax without prescrition a fixture formula. If it doesn't match, and so the handwriting leave print the line, other than non.
These admit a curated excerpt of the products and brands you’ve semen to be intimate and anticipate from us. And of course, our practiced Profane Shirts and Flake Squad Agents are there, standing by to help you with your tech, every whole step of the way of life. Our fresh Mercantile establishment stores likewise experience a Oddball Squad orbit where you ass gravel the endorse you need on your technical school.
In the interests of portability it is crucial to bill that unary -a is a non-criterion annex which won't be establish in POSIX. It is available in bang and ksh, however, so custom is in all likelihood far-flung. The switches -a and -n are not rigorously divide of a belt if instruction in that the if overtop does non treat these switches.

Bu soruya cevap vermek için lütfen giriş yapınız veya kayıt olunuz.

Hoş geldiniz, Soru Cevapla sizelere sorularınızın diğer kullanıcılarımız tarafından cevaplanması için bir ortam sağlar.

3.0k soru

35 cevap

2 yorum

1.6k kullanıcı

...