[Tutor] Error Handling in python
Chris “Kwpolska” Warrick
kwpolska at gmail.com
Thu Jul 24 14:37:11 CEST 2014
On Thu, Jul 24, 2014 at 2:23 PM, Wolfgang Maier
<wolfgang.maier at biologie.uni-freiburg.de> wrote:
> On 24.07.2014 14:19, Chris “Kwpolska” Warrick wrote:
>>
>>
>>>>> python test.py
>>>>> if [ $? = 0 ]; then
>>>>> python second.py
>>>>> fi
>>>>>
>>>>> as your shell script.
>>>>
>>>>
>>>>
>>>> The [ ] and = should be doubled.
>>>
>>>
>>>
>>> ?? why that ?
>>
>>
>> Double brackets can do more:
>>
>>
>> http://stackoverflow.com/questions/2188199/how-to-use-double-or-single-bracket-parentheses-curly-braces
>>
>
> But more is not required here. What am I missing ?
It’s recommended to switch to the [[ syntax anyways, some people
consider [ deprecated. Also, [ is actually /bin/[ while [[ lives in
your shell (and is therefore faster).
About the equals sign, == is the preferred syntax, and = is also
considered deprecated (zsh explicitly says so, bash says “only for
POSIX compatibility”.
--
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
More information about the Tutor
mailing list