Last active
August 29, 2015 14:23
-
-
Save mattintosh4/6fd44b3ec4f92ee03a30 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
char=a | |
declare -i int | |
int=a | |
declare -p char int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
fpath=/usr/local/bin/gistfile1.sh | |
echo "path : ${fpath}" | |
echo "dirname : ${fpath%/*}" | |
name=${fpath##*/} | |
echo "basename (w ext): ${name}" | |
echo "basename (w/o ext): ${name%.*}" | |
echo "extension : ${name##*.}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
path : /usr/local/bin/gistfile1.sh | |
dirname : /usr/local/bin | |
basename (w ext): gistfile1.sh | |
basename (w/o ext): gistfile1 | |
extension : sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ char=a | |
+ declare -i int | |
+ int=a | |
+ declare -p char int | |
declare -- char="a" | |
declare -i int="0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo $BASH | |
/bin/bash | |
$ echo $BASH_VERSION | |
4.3.11(1)-release | |
$ echo ${BASH}_VERSION | |
/bin/bash_VERSION | |
$ echo "$BASH"_VERSION | |
/bin/bash_VERSION | |
$ echo $BASH.VERSION | |
/bin/bash.VERSION |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ VERSION=VERSION | |
$ echo $BASH_$VERSION | |
VERSION | |
$ echo $BASH-$VERSION | |
/bin/bash-VERSION |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ declare -p BASH_VERSINFO | |
declare -ar BASH_VERSINFO='([0]="4" [1]="3" [2]="39" [3]="1" [4]="release" [5]="armv7l-unknown-linux-gnueabihf")' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare -p BASH_VERSINFO | |
echo \${BASH_VERSINFO[0]}: ${BASH_VERSINFO[0]} | |
echo \${BASH_VERSINFO[1]}: ${BASH_VERSINFO[1]} | |
echo \${BASH_VERSINFO[2]}: ${BASH_VERSINFO[2]} | |
echo \${BASH_VERSINFO[3]}: ${BASH_VERSINFO[3]} | |
echo \${BASH_VERSINFO[4]}: ${BASH_VERSINFO[4]} | |
echo \${BASH_VERSINFO[5]}: ${BASH_VERSINFO[5]} | |
echo \$BASH_VERSINFO[0]: $BASH_VERSINFO[0] | |
echo \$BASH_VERSINFO[1]: $BASH_VERSINFO[1] | |
echo \$BASH_VERSINFO[2]: $BASH_VERSINFO[2] | |
echo \$BASH_VERSINFO[3]: $BASH_VERSINFO[3] | |
echo \$BASH_VERSINFO[4]: $BASH_VERSINFO[4] | |
echo \$BASH_VERSINFO[5]: $BASH_VERSINFO[5] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare -ar BASH_VERSINFO='([0]="4" [1]="3" [2]="39" [3]="1" [4]="release" [5]="armv7l-unknown-linux-gnueabihf")' | |
${BASH_VERSINFO[0]}: 4 | |
${BASH_VERSINFO[1]}: 3 | |
${BASH_VERSINFO[2]}: 39 | |
${BASH_VERSINFO[3]}: 1 | |
${BASH_VERSINFO[4]}: release | |
${BASH_VERSINFO[5]}: armv7l-unknown-linux-gnueabihf | |
$BASH_VERSINFO[0]: 4[0] | |
$BASH_VERSINFO[1]: 4[1] | |
$BASH_VERSINFO[2]: 4[2] | |
$BASH_VERSINFO[3]: 4[3] | |
$BASH_VERSINFO[4]: 4[4] | |
$BASH_VERSINFO[5]: 4[5] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare -p BASH_VERSINFO | |
j=${#BASH_VERSINFO[@]} | |
for ((i = 0; i < j; i++)) | |
do | |
echo \${BASH_VERSINFO[${i}]}: ${BASH_VERSINFO[i]} | |
done | |
for ((i = 0; i < j; i++)) | |
do | |
echo \$BASH_VERSINFO[i]: $BASH_VERSINFO[i] | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare -ar BASH_VERSINFO='([0]="4" [1]="3" [2]="39" [3]="1" [4]="release" [5]="armv7l-unknown-linux-gnueabihf")' | |
${BASH_VERSINFO[0]}: 4 | |
${BASH_VERSINFO[1]}: 3 | |
${BASH_VERSINFO[2]}: 39 | |
${BASH_VERSINFO[3]}: 1 | |
${BASH_VERSINFO[4]}: release | |
${BASH_VERSINFO[5]}: armv7l-unknown-linux-gnueabihf | |
$BASH_VERSINFO[i]: 4[i] | |
$BASH_VERSINFO[i]: 4[i] | |
$BASH_VERSINFO[i]: 4[i] | |
$BASH_VERSINFO[i]: 4[i] | |
$BASH_VERSINFO[i]: 4[i] | |
$BASH_VERSINFO[i]: 4[i] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
CONVERT=`which convert` | |
for f | |
do | |
test -f "${f}" || continue | |
case ${f} in | |
*.?|*.??|*.???|*.????) | |
of=${f%.*}.jpg | |
;; | |
*) | |
of=${f}.jpg | |
;; | |
esac | |
test ! -e "${of}" || continue | |
( | |
set -x | |
${CONVERT} "${f}" "${of}" | |
) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment