Sponsored Content
Full Discussion: Tip: file_exists function
Top Forums Shell Programming and Scripting Tip: file_exists function Post 302921850 by RudiC on Monday 20th of October 2014 02:12:21 PM
Old 10-20-2014
Interesting.

But, as you test for any file, not a specific one, why not
Code:
file_exists() {   [ -f "$1" ] && return;   return 1; }

or even
Code:
file_exists() {   [ -f "$1" ];  return $?; }

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

one teaching Tip

Student have huge interest about why so many expert choose use UNIX than MS Windows. I consider that SHARE & OPEN is key point.:) (2 Replies)
Discussion started by: 111000
2 Replies

2. Solaris

tip into 280R

I need to use tip from machine A serial port to machine B serial port. Can someone point me to an example of the correct cable to use? Thanks. (1 Reply)
Discussion started by: dangral
1 Replies

3. Shell Programming and Scripting

Little bit of a help or just a tip

I am about to do a script that change the COST so i dont need to change each cost. The output looks like this. "OL_ID OL_LINK_COST ----------- ------------ 51 10 52 10 53 10 54 10 55 ... (3 Replies)
Discussion started by: maskot
3 Replies

4. UNIX for Advanced & Expert Users

if test -f $file_exists

Hi, I have a wiered problem probably unique to me. if test -f "${LOGDIRE}/Component_Name.sql" then echo "<br>Synchronization success<br>" else echo "<br>Sorry! Synchronizing failed" fi Considering, the file is present always, the above condition returns different outputs in each... (1 Reply)
Discussion started by: Nanu_Manju
1 Replies

5. Solaris

Solaris; tip

plz explain TIP in solaris in detail. (11 Replies)
Discussion started by: karman0931
11 Replies

6. Shell Programming and Scripting

Regexp tip

Hello, I'm just starting working on it. I'd like to get a tip For istance if I have a file like: a b c d e f .... and I wanna get: 1a & 2b & 3c 0d & 8e & 4f ..... I would like to use sed and come up with a regular expression that works.... (3 Replies)
Discussion started by: Dedalus
3 Replies

7. Shell Programming and Scripting

Search tip.

How do I find a key word in multiple files.. in a directory.. ? cat *.doc | grep -i myword? (7 Replies)
Discussion started by: hamon
7 Replies

8. Shell Programming and Scripting

Quick awk tip :)

how do i "awk" the date after the from only to compare it on a if statement later . filename example: server1-ips-ultranoob-ok_From_2012_21_12-23:40:23_To_2012_21_12-23:49:45.zip what i want o do is compare only the date from the string in "From_2012_21_12" in this case i only want the... (4 Replies)
Discussion started by: drd0spt
4 Replies

9. AIX

[TIP] Migration to POWER8

Read "Migration to POWER8" article to get prepared for migration to POWER8: link removed, advertisement (0 Replies)
Discussion started by: pave01
0 Replies

10. Shell Programming and Scripting

[Tip] A better echo

Often it has been said that echo is neither portable nor correct. Here is an input.txt: line1 line2 -n line4 -en line6 -x line8 Then the following fails with BSD/Linux/bash: while IFS= read line do echo "$line" done < input.txt It is elegantly improved by means of an echo... (2 Replies)
Discussion started by: MadeInGermany
2 Replies
Locale::Codes::LangVar(3pm)				 Perl Programmers Reference Guide			       Locale::Codes::LangVar(3pm)

NAME
Locale::Codes::LangVar - standard codes for language variation identification SYNOPSIS
use Locale::Codes::LangVar; $lvar = code2langvar('acm'); # $lvar gets 'Mesopotamian Arabic' $code = langvar2code('Mesopotamian Arabic'); # $code gets 'acm' @codes = all_langvar_codes(); @names = all_langvar_names(); DESCRIPTION
The "Locale::Codes::LangVar" module provides access to standard codes used for identifying language variations, such as those as defined in the IANA language registry. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language registry codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language variations. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lvar = code2langvar('en','alpha-2'); $lvar = code2langvar('en',LOCALE_CODE_ALPHA_2); The codesets currently supported are: alpha This is the set of alphanumeric codes from the IANA language registry, such as 'arevela' for Eastern Armenian. This code set is identified with the symbol "LOCALE_LANGVAR_ALPHA". This is the default code set. ROUTINES
code2langvar ( CODE [,CODESET] ) langvar2code ( NAME [,CODESET] ) langvar_code2code ( CODE ,CODESET ,CODESET2 ) all_langvar_codes ( [CODESET] ) all_langvar_names ( [CODESET] ) Locale::Codes::LangVar::rename_langvar ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangVar::add_langvar ( CODE ,NAME [,CODESET] ) Locale::Codes::LangVar::delete_langvar ( CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_alias ( NAME ,NEW_NAME ) Locale::Codes::LangVar::delete_langvar_alias ( NAME ) Locale::Codes::LangVar::rename_langvar_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::delete_langvar_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.iana.org/assignments/language-subtag-registry The IANA language subtag registry. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2012 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.2 2012-10-11 Locale::Codes::LangVar(3pm)
All times are GMT -4. The time now is 04:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy