It doesn't seem to work. The left part of the comparison might alsotechnosaurus wrote:[ $x == "*" ] && exit
need quotes.
In this case, I think I'll do like the pros. Spend 60 bytes writing up a bug
report, rather than 10 bytes to fix the program.
~
Code: Select all
#!/bin/bash
tar -tzf 2>/dev/null "$@"
Code: Select all
#!/bin/bash
tar -tzf 2>/dev/null "$@"
Are you are testing for x being equal to an asterisk?Bruce B wrote:It doesn't seem to work. The left part of the comparison might alsotechnosaurus wrote:[ $x == "*" ] && exit
need quotes.
Code: Select all
# x=*; if [ "$x" = '*' ]; then echo xxx; fi
Code: Select all
x=*; if [[ $x == '*' ]]; then echo xxx; fi
Code: Select all
set -- *; if [[ $1 == '*' ]]; then echo directory is empty; fi
Code: Select all
#!/bin/bash
for i in ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 \
: ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W \
X Y Z [ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v \
w x y z { | } ~
do
echo -n "$i "
done
echo
# ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9
# : ; < = > b @ A B C D E F G H I J K L M N O P Q R
# S T U V W X Y Z [ ] ^ _ ` a b c d e f g h i j k l
# m n o p q r s t u v w x y z { | } ~
See whether this is going to do what you want:Bruce B wrote:I want to reduce lines empty lines more than two to double lines.
Code: Select all
/dev/ram6 /mnt/ram ext2 rw,noatime,noauto,shortname=mixed,errors=continue 0 0
Bash is a command interpreter. I posted the full Bash help on the internal commands and -- is not listed as an internal command.Indy'spup wrote:ie: --version, or --help etc. etc.
Not exactly. To the shell that combination of characters means nothing special.Indy'spup wrote:Does the Prefix -- used often with a command/function have any specific meaning in bash?
Code: Select all
#!/bin/sh
#dependency check script
# '-f' param to check if dep is in ro filesystem (frugal)
Usage(){ #basic usage called by '-h' or no args
echo '
usage: -h : display help and exit
-f <app> : check read only filesystem (frugal types only)
<app> : the app you want to check' && exit 1
}
export -f Usage
#no args?
[ ! $1 ] && Usage
case $1 in
*-h*)
Usage
;;
-f) #arg only works with frugals, errors if not
[ ! -d /initrd/pup_ro2 ] && echo "not a frugal install, failure" && exit 1
APP=`which $2`
ROPATH="/initrd/pup_ro2"
;;
*)
APP=`which $1`
ROPATH=""
;;
esac
#meat and spuds
[ ! $APP ] && echo "no such application exists on your system" && exit 1 #does it exist?
FAIL=`ldd $APP|grep -i -E "not|no"`
[[ $FAIL ]] && echo "ldd error, not a dynamic executable" && exit 1 #it may be a script
LIST=`ldd $APP|sed 's/ /%/g'`
for DEP in $LIST #deps loop
do
BASEDEP=`echo $DEP|cut -d '%' -f1`
PATHDEP=`echo $DEP|cut -d '%' -f3`
FOUND=`find $ROPATH/usr/lib -name $BASEDEP`
[ ! $FOUND ] && FOUND=`find $ROPATH/lib -name $BASEDEP`
[ $FOUND ] && continue
[ ! $FOUND ] && echo $PATHDEP >> /tmp/deplist && echo $BASEDEP >> /tmp/finallist
done
NEWLIST=`cat /tmp/deplist`
for SUBDEP in $NEWLIST #deps of deps loop
do
SUBDEPLIST=`ldd $SUBDEP|cut -d ' ' -f1`
for FOUNDSUBDEP in $SUBDEPLIST
do
BASEFOUNDSUBDEP=`echo $FOUNDSUBDEP|cut -d '%' -f1`
FOUNDSUB=`find $ROPATH/usr/lib -name $BASEFOUNDSUBDEP`
[ ! $FOUNDSUB ] && FOUNDSUB=`find $ROPATH/lib -name $BASEFOUNDSUBDEP`
[ $FOUNDSUB ] && continue
[ ! $FOUNDSUB ] && echo "$BASEFOUNDSUBDEP" >> /tmp/finallist
done
done
cat /tmp/finallist|sort -u #display results
#cleanup temp
rm /tmp/finallist 2>/dev/null
rm /tmp/deplist 2>/dev/null
exit 0
#end
How do I make a script and make it executable?Bruce B wrote:
Here is a very simple script that won't seem to work. Please try it.
Scriptname rAfter you've made it executable, run it.Code: Select all
#!/bin/bash cd /
I believe you meanIn the meantime chown 755 scriptname will suffice
Code: Select all
chmod 755 scriptname
I did. Thank you very much. I'll edit the original.rcrsn51 wrote:I believe you meanIn the meantime chown 755 scriptname will sufficeCode: Select all
chmod 755 scriptname
Code: Select all
chmod +x scriptname