Sponsored Content
Top Forums Shell Programming and Scripting if test in bash - can't see error Post 302665725 by jayan_jay on Tuesday 3rd of July 2012 05:51:50 AM
Old 07-03-2012
Code:
if [ -f "$file_name" ]; then
        echo File $file_name Found
else
        echo File $file_name Not Found
fi

Alternate one ..
Code:
$ [ -f "$file_name" ] && echo "Filename $file_name Found" || echo "Filename $file_name Not Found"

This User Gave Thanks to jayan_jay For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

regex test in bash

Hi I want to do a regex test and branch based on the test result, but this doesn't seems to work :confused: if \) ]] then echo success else echo failed fi (1 Reply)
Discussion started by: subin_bala
1 Replies

2. Shell Programming and Scripting

test-and-set in bash

I'm not talking about the assembly instruction TAS, a better name could be check-and-set :) Anyway, is there a way to simplify the following if ; then VAR="something"; fi I have ~20 variables that should be test-and-set like this, and it really looks lame. (2 Replies)
Discussion started by: rayne
2 Replies

3. Shell Programming and Scripting

[bash]regexp to test PrintableString

Hello all, I would like some help to find the regexp to test that a word does not contains anything than the character set of printable strings. Especially the word should not contain a underscore. echo "$word" | grep "( \'\(\)+,-\.:=\?)+" if then echo success else echo failed... (2 Replies)
Discussion started by: dolphin06
2 Replies

4. Shell Programming and Scripting

FIle (directory) test operator (bash)

I'm almost pulling out my hair trying to figure out what's wrong with this... there's no reason I can see that it shouldn't be working. It seems that the code acts as though the conditional statement is true no matter what - I've even tried removing the negation operator, but it always goes into... (5 Replies)
Discussion started by: wildbluefaerie
5 Replies

5. Shell Programming and Scripting

bash script to test network connection - please help

I want to test if my host can connect to any of the following 10 hosts (192.168.1.0 to 192.168.1.9) I didnt know which command i should use, so i chose ping. (i wonder if i should use tracepath or sth else) my code is the following: #!/bin/bash clear firstPart="192.168.1" maxNum="9" ... (2 Replies)
Discussion started by: shadow_boi
2 Replies

6. Shell Programming and Scripting

Test on string containing spacewhile test 1 -eq 1 do read a $a if test $a = quitC then break fi d

This is the code: while test 1 -eq 1 do read a $a if test $a = stop then break fi done I read a command on every loop an execute it. I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test. For example echo hello. Now the... (1 Reply)
Discussion started by: Max89
1 Replies

7. Shell Programming and Scripting

Bash script to test IP range on server

Hello, We have to configure servers with a range of IPs which is in itself a subject for another script assistance request -but- we have run into quite a few IP ranges with routing problems lately. I've been trying to figure out the best way to test a range of IPs, I mean, manually it's not... (4 Replies)
Discussion started by: boxgoboom
4 Replies

8. Shell Programming and Scripting

[Solved] Bash test 2 variables to see if ones greater by n

Experts, I have a bash shell script that generates 2 variables that have the current minute and a minute from a log file. Can someone please show me the best way to test if the minutes stray by 5. So basically if: This is ok: Last Fitting Min ============= 02 Current Minute =============... (2 Replies)
Discussion started by: jaysunn
2 Replies

9. Shell Programming and Scripting

Operator test in bash

Hello, can you please help me because I am totally confused with a simple script: #!/bin/bash ] || ] && echo "Good Morning" ] || ] && echo "Good Night" For me, these two strings are indentical: false || false and there is no point to execute echo command. But the run result is... (5 Replies)
Discussion started by: AndreiM
5 Replies

10. UNIX for Dummies Questions & Answers

Bash condition test at the end of string

I want to check (using bash condition test function) if string contains three spaces, ignoring last three spaces at the end of string. string_to_report='foo bar foo bar ' string_to_ignore='foo bar ' (8 Replies)
Discussion started by: useretail
8 Replies
CUBRID_SAVE_TO_GLO(3)							 1						     CUBRID_SAVE_TO_GLO(3)

cubrid_save_to_glo - Save requested file in a GLO instance

SYNOPSIS
int cubrid_save_to_glo (resource $conn_identifier, string $oid, string $file_name) DESCRIPTION
The cubrid_save_to_glo(3) function is used to save requested file in a glo instance. PARAMETERS
o $conn_identifier -Connection identifier. o $oid -Oid of the glo instance that you want to save a file in. o $file_name -The name of the file that you want to save. RETURN VALUES
TRUE, when process is successful. FALSE, when process is unsuccessful. EXAMPLES
Example #1 cubrid_save_to_glo(3) example <?php $req = cubrid_execute ($con, "select image from person where id=1"); if ($req) { list ($oid) = cubrid_fetch($req); cubrid_close_request($req); $res = cubrid_save_to_glo ($con, $oid, "input.jpg"); if ($res) { echo "image changed successfully"; } } ?> NOTES
Note For backward compatibility, the following deprecated alias may be used: cubrid_save_to_glo(3) Note This function is removed from CUBRID 3.1. SEE ALSO
cubrid_new_glo(3), cubrid_load_from_glo(3), cubrid_send_glo(3). PHP Documentation Group CUBRID_SAVE_TO_GLO(3)
All times are GMT -4. The time now is 03:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy