[Solved] Problem bash if file exists then < do...> else <do...>
Hi !
I have a problem with an if/else statement in bash.
I want to check if the file exists before running a task (for example here, counting lines), and if not I need to create an empty output file
The problem is even if the condition is true (the file actually exists) it goes directly to the else part and create an empty file in any case.
Could someone explain me what is wrong with my syntax... !!!
Hello,
I wonder whether if we have a open file dialog as (in gtk+) in html. I know that a submit-type form (such as <input value="Add File" type="submit">) opens such dialog, but it -naturally- tries to submit the file chosen. I only want to find out the file name, not upload it.
Thanks! (0 Replies)
I'd like a bash script to simply check to see if any file/files are present in a source directory, and if so move it/them to a target directory.
I have this but it doesn't work:
#!/bin/bash
if
then
mv /source/* /target
fi
What is the right syntax? Thanks! (4 Replies)
Hello
I have srv RHEL5, file system UTDM (EMC DiskXtender Unix/Linux File System Manager 3.5 & EMC Centera).
it all works under the scheme: have disk is formatted with a file system UTDM, drive open network - NFS, it write data, then migrate the data in the repository - EMC Centera.
There are... (0 Replies)
basically im trying to make this work in a bash shell script without using if statements
if
then
echo testfile exists!
fi
what it does is check if the file exists or not
i have this line but its not working, it checks if the testfile exists if it doesnt it 2> to the dev null... (3 Replies)
hello. this is the code
#!/bin/sh
total1024=0
total2048=0
total8192=0
if ; then
if ; then
while read variable
do
if ; then
total1024=$(( $total1024 + 1 ))
fi
if ; then
total2048=$((... (4 Replies)
Hey all,
Here's my dilemma:
1. I'm a newbie at scripting!
2. I need to create a script that checks: If a file size is equal to zero, then stop the installation.
Is there a way to do this or am I wasting my time???
Thanx in advance! :b: (2 Replies)
Hi
#Testing for file existence
if ; then
echo 'SCHOOL data is available for processing'
else
echo 'SCHOOL DATA IS NOT AVAILABLE FOR PROCESSING'
:
i wrote a script, where it begins by checking if file exists or not.
If it exists, it truncates the database... (2 Replies)
Hi!
I wanted to simplify my bash prompt, so I edited my etc/bashrc file. I thought this was the file that would override any other env files. When I opened it, I saw that the way it was setup was not what my prompt looked like, although I forget exactly what was there. But i edited it the way I... (1 Reply)
Hi All,
I am facing a problem while checking for existence of file over ssh !
Basically, i want to ssh and check if file exists.. If file exists return 1. If file does not exits return 0 (or any value)
I am using the below code
file_avail=`ssh username@host "if ]; then exit 1;... (10 Replies)
OK So I Recently Bought A whatbox Seed-box Act!!:cool:
I am connected to whatbox via SSH!!!
Now i have downloaded a movie and renamed it to 2yify.mp4 (800MB):o
When I TYPE the command to split it which is:)
split -b 400m 2yify.mp4
It gets renamed into two parts with different names... (4 Replies)