954,546 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

need help in this

Here is part of my code-

extrafiles1=$(ls mt.*.*.*.*) 
            if [[ $(ls -l $file 2>/dev/null) = *$today* ]]; 
		then
                           if [[ $file -eq $extrafiles1 ]];then
                                    rm $file
                           fi
            fi

when i am running the script it's showing an error--

mtclean[239]: ./mt.log.8882.-5.1202989443474: bad number.
when i just ran this command on the unix prompt itgave me this--
webmut2@france>extrafiles1=$(ls mt.*.*.*.*)
webmut2@france>$extrafiles1
ksh: mt.log.8882.-5.1202983177934: cannot execute
these files dont have execute permission,but they do have -r-w permissions.i have to delete the files with that extensions,please help me out in tht.

why it is so,is the variable assignment is not right.Give me ur suggestions.

--------------------------------------------------------------------------------

larryperl
Junior Poster in Training
51 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 
extrafiles1=$(ls mt.*.*.*.*) 
extrafiles2=$(ls *core*)

my question is--
suppose if there is no files matching with the criteria mentioned above it will display message on the window--
mt.*.*.*.* not found
*core* not found

i do not want to display this message on the window even if it do not find any files matching with the criteria,how can i do that.

larryperl
Junior Poster in Training
51 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 

extrafiles2=$(ls *core* 2>/dev/null)

something like that?

DimaYasny
Posting Virtuoso
Moderator
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You