Witam,
POniewaz to jest mój pierwszy post to mówię wszystkim cześć:)
Napisalem skrypt ktory:
- pobiera zawartosc pliku z jednego katalogu w komputerze A i wyswietla w komputerze B
- FTP zaznaczony plik z kompa A do kompa B'
Problem w tym, ze chcialbym aby wylistowana zawartosc w terminalu byla uporzadkowana wedlug daty. Jak to zrobic i co zmienic.
Z gory dzieki za podowiedz.
Pozdrawiam,
c
#!/bin/sh -f
#############################################################
#
#
#############################################################
#
#
#
#Connecting to a Spectra
HOST='192.168.1.1'
USER='user'
PASSWD='user'
SPECTRA_DIR='/a/b/'
SPRINT_DIR='/c/d/e'
#Removing old list from last listining
#Removing temporary files from last listening
rm dirlisting.txt
#Creating a new empty files.
touch dirlisting.txt
#Setting local directory for Sprint.
cd $SPRINT_DIR
#Ftp to Spectra 1 computer to get file listining
ftp -n -i $HOST <quote USER $USER
quote PASS $PASSWD
cd $SPECTRA_DIR
#The file dirlisting.txt contains of a files in the Spectra 1 P2/94 directory
ls *.* dirlisting.txt
bye
end_of_script
#Setting local directory
cd $SPRINT_DIR
#Listining files from older to newer.
#sort dirlisting.txt
#Selecting a files
cat dirlisting.txt | sort -t - -k1
echo -n "Select from the file above and past after arrow ==> "
read FILE
#Deleting the temporary file drilisting.txt
rm dirlisting.txt
#Connect to Spectra 1 directory to get the P2 files
ftp -n -i $HOST <quote USER $USER
quote PASS $PASSWD
bin
cd $SPECTRA_DIR
#Prininting hash symbols to show progress on of the FTP transfer
#hash
get $FILE
bye
end_of_2_script
echo "------------------------------------------------------"
echo "==>> Check of the first and last shotpoint recorded corectly excl.gif!<<=="
echo " "
grep "E1000" $FILE > shots_check
head -n 1 shots_check
tail -1 shots_check
echo "------------------------------------------------------"