-1

I need understand this:

df -ah >/opt/pub/software/tmp/Active_directory.txt
find . -type f  -exec ls -l {} \; | sort -nr -k 5  >>/opt/pub/software/tmp/Active_directory.txt&id=$!

#!/bin/bash
#recolecta.sh
date;echo 'Command is running, it will cost about 10 minutes, please wait...'
cd /opt/
df -ah >/opt/pub/software/tmp/Active_directory.txt
find . -type f  -exec ls -l {} \; | sort -nr -k 5  >>/opt/pub/software/tmp/Active_directory.txt&
id=$!
char=("-" "/" "|" "\\") 
n=0 
while ps -ef |grep "$id" |grep -v grep > /dev/null 
do
       echo -ne "\rCommand is running, it will cost about 10 minutes, please wait...${char[$n]} " 
        n=$(( (n+1)%4 )) 
        sleep 1 
done
ls -lht -R >>/opt/pub/software/tmp/Active_directory.txt
tree >>/opt/pub/software/tmp/Active_directory.txt
REMOTE_HOST=$(getOMUName|grep REMOTE_HOST|awk -F '='  '{print $2}')
ssh $REMOTE_HOST
1
  • 1
    Please edit your question to include your code as text instead of a picture, and ask a specific question: what part do you not understand? – dhag Mar 3 '17 at 19:59
2

You need to be more specific in your question. If I understood it well, you have doubt about the df and find commands in the bash script. So, here is a explanation:

df -ah >/opt/pub/software/tmp/Active_directory.txt
  • Report file system disk usage, including pseudo, duplicate and inaccessible file systems (-a) in human readable format (-h), then create (or overwrite) a file named Active_directory.txtwith the output.

find . -type f -exec ls -l {} \; | sort -nr -k 5 >>/opt/pub/software/tmp/Active_directory.txt & id=$!

  • Find in current directory any matchs of file type, execute ls -l (long list) for each matching file, sorting the output by numeric order of column 5 and reversing it (That means: Bigger files first). Then, append the output to the file /opt/pub/software/tmp/Active_directory.txt. This whole command is executed in background (&). The PID of this job ($!) is saved in a variable named id.
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.