![]() |
|
Programming C, bash, Python, Perl, PHP, Java, you name it. |
![]() |
|
Thread Tools | Display Modes |
|
||||
![]() Code:
if [ -f file ]; then echo "file exists" fi if [ -d dir ]; then echo "dir exists" fi
__________________
religions, worst damnation of mankind "If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus Torvalds Linux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”. vermaden's: links resources deviantart spreadbsd |
|
||||
![]() Quote:
So why do you ask: Quote:
Code:
if [ ! -f file ]; then echo "file does not exist" fi if [ ! -d dir ]; then echo "dir does not exist" fi Code:
[ ! -f file ] && echo "file does not exist" [ ! -d dir ] && echo "dir does not exist" Quote:
http://developer.apple.com/documenta...ShellScripting http://developer.apple.com/documenta...lScripting.pdf http://tldp.org/LDP/abs/html/
__________________
religions, worst damnation of mankind "If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus Torvalds Linux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”. vermaden's: links resources deviantart spreadbsd |
|
||||
![]() Quote:
I did tried -!f -f!, didn't thought about trying ! -f ![]() |
|
|||
![]()
to just check if any file with whatever type exist use -e option in test then do what you have/want to do with the file
__________________
Verbose mode can also be turned on for SSH2 with the (surprise!) VerboseMode keyword. |
|
||||
![]()
@killasmurf
You are welcome.
__________________
religions, worst damnation of mankind "If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus Torvalds Linux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”. vermaden's: links resources deviantart spreadbsd |
|
||||
![]()
Also take a look at test(1).
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
PHP read file contents - Maximum file size | cksraj | Programming | 1 | 21st September 2009 11:38 AM |
ifconfig: SIOCAIFADDR: File exists | zomo | OpenBSD General | 7 | 23rd December 2008 10:20 PM |
File system at more than 100% | michaelrmgreen | FreeBSD General | 4 | 28th July 2008 01:52 PM |
file:/// | mfaridi | FreeBSD Security | 3 | 27th July 2008 02:18 PM |
VSFTPd: pid file | kostromin | FreeBSD Ports and Packages | 0 | 4th July 2008 08:35 AM |