Sponsored Content
Top Forums Shell Programming and Scripting Escaping the * character in ksh. Post 302196685 by arvindcgi on Monday 19th of May 2008 07:54:45 AM
Old 05-19-2008
But if i don't backslash it, then "*" is getting replaced with all the file name in present directory. Hope i'm clear with my question.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Newline character not working for ksh

Newline character "\n" not working for ksh in linux AS 3.0 Command : $echo "Hi\nHi" $Hi\nHi $ Expected output : $echo "Hi\nHi" Hi Hi $ Can some help me on this Thanks in advance Sanish. (11 Replies)
Discussion started by: sanikv
11 Replies

2. Shell Programming and Scripting

KSH - Character Replacement

Hey all. Easy question. I have a (ksh) varaible x. It contains the following (for example): N557788 I want to replace the "N" with a "-". I've done this before but for the life of me I cannot remember how I did it. Thanks. mtw (2 Replies)
Discussion started by: mixxamike
2 Replies

3. Shell Programming and Scripting

problem escaping newline in ksh

Hi, I did the below. $ print "\\n" $ I am curious, why does \\n give two new lines? I would have thought that the first \ would escape the second \, and so we'd get \n printed. But we didn't. Any ideas? Thanks. (7 Replies)
Discussion started by: JamesByars
7 Replies

4. UNIX for Dummies Questions & Answers

odd character (^M) from .sh when chagining to .ksh

// AIX 5.3 I am trying to use .sh after changing it to .ksh Obviously, it doesn't like the file extension change. I am seeing a lot of odd characters (^M) like below: Init_Part2 ()^M^M {^M^M AWTRACE "AW SET"^M^M set | grep -e CFG_ -e OUTDIR_ENV^M^M AWTRACE "AW SET"^M^M ^M^M if ;... (2 Replies)
Discussion started by: Daniel Gate
2 Replies

5. Shell Programming and Scripting

Escaping specific character in awk

Hello there, I have a bit of dirty delimited file, I mentioned dirty because, the delimiter can also appear in wrong positions. However, one uniqueness of this file is whenever the delimiter appear inside the double quote, then do not consider as delimiter, if it appear outside double then... (8 Replies)
Discussion started by: brainyoung
8 Replies

6. UNIX for Advanced & Expert Users

Escaping special character stored in variables : perl

Hi just for regular use i m working on small module written in perl for getting date in specified format like i have to specify date format and then seperator to seperate date i am 95% done. now i m sure explanation i gave is not good enough so i am putting output here : C:\Documents and... (2 Replies)
Discussion started by: zedex
2 Replies

7. Shell Programming and Scripting

please explain why this ksh echo deletes character

Please explain why this works. Am unable to find another definition for the '%', which would explain this behaviour: spaceLeft=`df -h /myPartition | tail -1` # output looks like: /dev/sda5 10G 1.2G 12G 29% / set -- $space #this deletes the trailing '%' sign, which is... (6 Replies)
Discussion started by: frododot
6 Replies

8. Shell Programming and Scripting

ksh escape a character

friends, I have a situation where i am using a $RANDOM function along with the filename, I want this to be escaped by the OS in the first assignment (works as expected) and executed in the second assignment (does not execute $RANDOM) filename1=filename1_\$RANDOM echo $filename1... (3 Replies)
Discussion started by: Balaji M
3 Replies

9. Shell Programming and Scripting

sed - replacement file path with variable - Escaping / character

Hi,, I have the line below in a file: $!VarSet |LFDSFN1| = '"E:\APC\Trials\20140705_427_Prototype Trial\Data\T4_20140705_Trial_Cycle_Data_13_T_Norm.txt" "VERSION=100 FILEEXT=\"*.txt\" FILEDESC=\"General Text\" "+""+"TITLE{SEARCH=NONE NAME=\"New Dataset\" LINE=1I want to write a script to change... (2 Replies)
Discussion started by: carlr
2 Replies

10. UNIX for Beginners Questions & Answers

Escaping a variable in ksh

I am trying to echo a variable exactly to a script- echo "${var1} ${var2} >> output.output Gives me a blank file. I would like output.output to basically say: ${var1} ${var2} I think I need to use a special escape character for variables. Am I right in assuming that, and is it the... (8 Replies)
Discussion started by: jeffs42885
8 Replies
fnmatch(3C)															       fnmatch(3C)

NAME
fnmatch() - match filename patterns SYNOPSIS
DESCRIPTION
performs pattern matching as described in regexp(5) under By default, the rule qualifications for filename expansion do not apply; i.e., periods (dots) and slashes are matched as ordinary characters. This default behavior can be modified by using the flags described below. The flag argument modifies the interpretation of pattern and string. If which is defined in is set in flag, a slash character in string must be explicitly matched by a slash in pattern; it cannot be matched by either the asterisk or question mark special characters or by a bracket expression. If is set in flag, a leading period must be explicitly matched. It will not be matched by a bracket expression, question mark or asterisk. By default, a period is leading if it is the first character in string. If is set in flag, a period is leading if it is the first charac- ter in string or immediately follows a slash. If is not set in flag, a backslash character in pattern followed by any other character matches that second character in string. In par- ticular, matches a backslash in string. If is set, a backslash character is treated as an ordinary character. If flag is zero, the slash character and the period are treated as regular characters. If flag has any other value, the result is unde- fined. RETURN VALUE
If string matches the pattern specified by pattern, returns zero. Otherwise, returns non-zero. EXAMPLE
The following excerpt uses to check each file in a directory against the pattern pattern = "*.c"; while(dp = readdir(dirp)){ if((fnmatch(pattern, dp->d_name,0)) == 0){ /* do processing for match */ ... } } AUTHOR
was developed by OSF and HP. SEE ALSO
sh(1), glob(3C), thread_safety(5). STANDARDS CONFORMANCE
fnmatch(3C)
All times are GMT -4. The time now is 12:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy