[prog] bash script

Wolf Rising wolfrising at gmail.com
Fri Jan 21 15:34:20 UTC 2011


Would anyone happen to see the syntax error in this code snippet?

#push information to a file for sed to read
ls -l /$directory > /tmp/file

#create file variable
file="/tmp/file"

case $var in
     1) echo "These are regular files:"
        sed -n '/^-/p' $file
            if [ "sed -n '/^!-/p' $file" ];
              then
                echo "No items found which match your criteria."
            fi
        ;;



It's a little bash script that checks file types by the first character, I
wanted to add an if clause but I
seem to have an error [ "sed -n '/^!-/p' $file" ] as it skips over this an
prints the echo statement
whether the file type is found or not.

Thanks!


More information about the Programming mailing list