|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
plese help-comparison string
i want to search for file that start with file200411*. i can't pass the variable. should i use grep?
the output will appear as "nor exist" although there is a file in a directory so..please help #!/bin/sh yr=2004 mth=11 for file in ls file* do if [ "$file" = "file$yr$mth*.txt" ] then echo "file exist, $file" else echo "file not exist" fi done |
|
#2
|
|||
|
|||
|
use 'if' for numerical tests
use 'case' for all other Code:
for file in `ls`
do
case $file in file$yr$mth*.txt) XXX= ;; *) XXX=not ;; esac
echo "file $file does $XXX exist"
done
Last edited by guggach : December 30th, 2004 at 06:17 AM. Reason: typo |
|
#3
|
||||
|
||||
|
Quote:
why not just use find? Code:
find . -name "file200411*" -print christo or does this definititel h
__________________
. Spiration channels: Free scripts, programming tutorials and articles Dotcut alerts: Online Press cuttings / news alerts Clearprop: UK microlight school, wiltshire Uk dating: UK safe dating with Topdates About Christo . . |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > plese help-comparison string |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|