Once you get lost in git and you could try to find it by the following commands $ git fsck --lost-found $ git reset HEAD@{1} Wish this helps. regards, Stanley Huang
If you want to give a list for user to choose, you can use the option "--list". The command synopsis as below: SYNOPSIS zenity --list [--title=title] [--window-icon=path] [--width=width] [--height=height] [--timeout=seconds] [--column=text] [--checklist] [--radiolist] [--separator=character] [--multiple] [--editable] [--print-column=number] [--hide-column=number] Just like " --calendar ", if you press "ESC" key or click button "Cancel", the return code will be "1". If you select one option and click "OK", zenity will response the option and return the code will be "0". And also the same effect about the options "--title", "--timeout"...etc, for saving your time, please refer to the previous post " [Level 2] Shell Interactive With Zenity Episode 1 -- calendar ", too. About "--multiple" and "--separator", please refer to tht previous post " [Lev...
If you want to implement iif in Python, please refer to the following sample code: #!/bin/env python def iif(b): return 'It\'s True' if b else 'It\'s False' print iif(True) print iif(False) And the following sample, guess what will you get! #!/bin/env python b = True print 'b: %s' % 'Ture' if b else 'False' b = False print 'b: %s' % 'Ture' if b else 'False' Result: $ ./iif.py b: Ture False The second result is "False", not "b: False". Why??? Because the prededence of string concatenation is higher than if. Therefore you need to use () to make it correct. #!/bin/env python b = True print 'b: %s' % 'Ture' if b else 'False' b = False print 'b: %s' % ('Ture' if b else 'False') Wish this helps. regards, Stanley Huang
Comments
Post a Comment