#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    Scripting need help!


    so this is my code already.

    clear
    tput cup 1 1; echo "THE DIRECTORY WHERE THE SCRIPT IS RUN:"
    tput cup 1 40; echo pwd
    tput cup 3 21; echo "Total number of hidden files:"
    tput cup 3 50; ls -a | awk '!/^d/{print}' | wc -l
    tput cup 4 1; echo "Total number of unhidden files in this directory:"
    tput cup 4 50; ls -l | awk '!/^d/{print}' | wc -l
    tput cup 5 52; echo "====="
    tput cup 6 45; echo "Sum total:"

    what am i going to do if i'm going to add the total of hidden files and the unhidden files? could anyone help me?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,477
    Rep Power
    1752
    Instead of:
    Code:
    tput cup 3 50; ls -a | awk '!/^d/{print}' | wc -l
    and
    Code:
    tput cup 4 50; ls -l | awk '!/^d/{print}' | wc -l
    Use:
    Code:
    numa=$(ls -a | awk '!/^d/{print}' | wc -l)
    tput cup 3 50 echo $numa
    and
    Code:
    numl=$(ls -a | awk '!/^d/{print}' | wc -l)
    tput cup 3 50; echo $numl
    numt=$(( numa + numl))
    Then do an echo at the relevant location of $numt
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc

IMN logo majestic logo threadwatch logo seochat tools logo