Advertisement
kazoda

Check existing

May 21st, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.50 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. while read line
  4. do
  5.    fpath=$(echo "${line}" | cut -d':' -f2)
  6.    if [ "${line: -1}" = "*" ];then
  7.       err_flg=0
  8.       for f in $(ls -1 ${fpath})
  9.       do
  10.          if [ ! -e "${f}" ];then
  11.             err_flg=1
  12.          fi
  13.       done
  14.       if [ ${err_flg} -eq 1 ];then
  15.          echo "Error"
  16.       else
  17.          echo "${line}"
  18.       fi
  19.    else
  20.       if [ -e "${fpath}" ];then
  21.          echo "${line}"
  22.       else
  23.          echo "--Error"
  24.       fi
  25.    fi
  26. done < /root/work/a.list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement