Sponsored Content
Homework and Emergencies Emergency UNIX and Linux Support Waiting for wildcard filename to exists in while loop Post 302916825 by rbatte1 on Friday 12th of September 2014 05:52:05 AM
Old 09-12-2014
It's always dangerous to want a wildcard character as part of a filename, but you can do this:-
Code:
until [ -f Trigger\*.done ]
do
 ......

You must make sure that you escape every usage of the file name correctly, and if you are setting it as a variable, you might need to double escape it, i.e.
Code:
file="Trigger\\\*.done"
until [ -f Trigger\*.done ]
do
 ......

... so you escape the escape character too so that doesn't get interpreted on setting the variable.


I still worry that you may make a mistake with serious consequences. You might be better using a file called All_Trigger.done instead for clarity and to minimise the risks, especially of any maintenance to your code later on.




Robin
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Find wildcard .shtml files in wildcard directories and removing them- How's it done?

I'm trying to figure out how to build a small shell script that will find old .shtml files in every /tgp/ directory on the server and delete them if they are older than 10 days... The structure of the paths are like this: /home/domains/www.domain2.com/tgp/ /home/domains/www.domain3.com/tgp/... (1 Reply)
Discussion started by: Neko
1 Replies

2. Shell Programming and Scripting

test if a filename exists with specified string (ksh)

I'm trying to do a simple if statement that tests if a filename exists with a user specified string. So say I have these files: Assigned_1day_after_due_chuong Assigned_1day_after_due_gallen Assigned_1day_after_due_heidenre and i'm running a script and want to know if a... (6 Replies)
Discussion started by: bob122480
6 Replies

3. Shell Programming and Scripting

filename in loop

i have a filename_1=file1.dat filename_2=file2.dat i want to pass the filename in a loop for((i=1;i<=2;i++) do awk{print $1} $filename_$i.dat done how should i pass the filename (2 Replies)
Discussion started by: r_t_1601
2 Replies

4. Shell Programming and Scripting

ksh(!93) for loop with wildcard and empty directory

I'm sure this is by design, but using something like for f in dir/* do echo $f done produces unexpected (to me) results if run against an empty directory. I'd have expected it to not execute the loop, but it actually calls it with f set to 'dir/*'. Now I know that I'm trying to protect... (2 Replies)
Discussion started by: spr00t
2 Replies

5. Shell Programming and Scripting

Use the information from filename in a for loop

hi here is my script set -vx b=`cat /info_d05/visage/SrcFiles/Customer_Master/Log_Files/last_date.txt` for name in /info_d05/visage/SrcFiles/Customer_Master/Input_Files/* do fname=`basename $name` p=`$fname|cut -d"_" -f6|sed 's/\(.*\)....../\1/'` if then cp... (6 Replies)
Discussion started by: djrulz123
6 Replies

6. Shell Programming and Scripting

Wildcard search in if loop

Practice folder contains many files and im interested in extracting file which starts with abc* ghi* xyz* . I need to do variety of operations for different files. if file starts with xyz* then i need to move to some destination otherwise some other destination. I am not able to make wildcard... (15 Replies)
Discussion started by: kumaar1986
15 Replies

7. Shell Programming and Scripting

For loop without checking file exists

In several scripts that process files matched by name pattern I needed to add a check for file existence. Just to illustrate let's say I need to process all N??? files: /tmp$ touch N100 N101 /tmp$ l ?10 -rw-rw-r-- 1 moss group 0 Apr 19 11:22 N100 -rw-rw-r-- 1 moss group ... (10 Replies)
Discussion started by: migurus
10 Replies

8. Shell Programming and Scripting

Verify if filename exists

Hi, I have a variable returned from Oracle SQL Function which holds file names. I would like to test if all the file names mentioned in the string exists in a directory. If all the files exists print "exists", even if one file does not exists print "Does not exists". e.g. ... (3 Replies)
Discussion started by: pointers1234
3 Replies

9. AIX

Issue with wildcard in filename (AIX 7.1.0.0)

Hi, This has been pestering me for quite a while, any help will be highly appreciated The current directory has a file with below name npidata_20050523-20171210.csv The below wildcard matched the above file ls -ltr npidata_????????-201712??.csv But when the part '201712' is put... (6 Replies)
Discussion started by: zulfi123786
6 Replies
jistoeuc(1)							   User Commands						       jistoeuc(1)

NAME
jistoeuc, jistosj, euctojis, euctosj, sjtojis, sjtoeuc - Code conversion between JIS, PC kanji, and Japanese EUC SYNOPSIS
jistoeuc [-8] [-U] [filename...] jistosj [-8] [-U] [filename...] euctojis [-8] [-U] [filename...] euctosj [-U] [filename...] sjtojis [-8] [-U] [filename...] sjtoeuc [-U] [filename...] AVAILABILITY
SUNWjfpu DESCRIPTION
For Japanese language handling, the jistoeuc family provides conversion between different code standards. command [ filename ...] does the specified conversion on the contents of the input filenames and writes it to stdout. If filename is not given, it reads and converts characters from the standard input. jistoeuc converts JIS to Japanese EUC jistosj converts JIS to PC kanji euctojis converts Japanese EUC to JIS euctosj converts Japanese EUC to PC kanji sjtojis converts PC kanji to JIS sjtoeuc converts PC kanji to Japanese EUC OPTIONS
-8 With this option specified, the commands jistoeuc, jistosj, sjtojis, and sjtoeuc, can support JIS X 0201 (Half-Size Katakana). This 8-bit JIS code does not use ISO Shift-In and Shift-Out escape sequences. -U The output is not buffered (The default is buffered output). SEE ALSO
iconv(1), iconv_ja(5) NOTES
This command can handle shift-in escape sequences for the following character sets: JIS X 0208 shift-in escape - E$B, E$(B, E$@ JIS X 0212 shift-in escape - E$(D JIS X 0201 Roman shift-in escape - E(J, E(H ASCII shift-in escape - E(B euctojis and sjtojis can handle shift-in escape sequences for the following character sets: JIS X 0208 shift-in - E$B JIS X 0212 shift-in - E$(D (except when sjtojis command is specified) JIS X 0201 Roman shift-in - E(J jistoeuc does not check whether or not each code in the input file is correct. Conversion with PC kanji is not based on TOG Japanese Ven- dors Council (TOG/JVC) Recommended Code Set Conversion Specification between Japanese EUC and Shift-JIS. The iconv(1) utility provides these functions. See iconv(1) and iconv_ja(5) for more information. BUGS
If JIS X 0212 character set is specified as input, jistosj and euctosj can not support the conversion correctly. euctosj, sjtoeuc, jis- tosj, and sjtojis can support conversion correctly only if JIS X 0208 1 ku - 84 ku is specified as input. SunOS 5.10 10 Jan 2003 jistoeuc(1)
All times are GMT -4. The time now is 11:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy