How can i use shell meta characters like * ,$ <,> ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How can i use shell meta characters like * ,$ <,> ?
# 1  
Old 08-08-2009
How can i use shell meta characters like * ,$ <,> ?

hey guys!!

please tell me ...how can i use shell meta characters like * ,$ <,> etc in command line
in command line arguments literally
please reply soon ..its urgent!!!!
# 2  
Old 08-08-2009
Meta characters can usually be escaped with \, or lose their meaning when single quoted.

For a better description read the man pages.
# 3  
Old 08-08-2009
[root@localhost scripts]# cat get_values
echo $1

[root@localhost scripts]# ./get_values $
$

[root@localhost scripts]# ./get_values abc
abc

[root@localhost scripts]#
# 4  
Old 08-08-2009
The $ isn't the best example, it has no special meaning on it's own.

Code:
/tmp# ./get_values $
$
/tmp# ./get_values \
>    (waiting for something)
/tmp # ./get_values \\
\
/tmp# ./get_values '
>  (waiting for a single quote)
/tmp# ./get_values \'
'
/tmp/TMP # ./get_values '\'   
\


Last edited by Scott; 08-08-2009 at 08:19 AM.. Reason: didn't paste the last bit of the example
# 5  
Old 08-08-2009
Thanks Scott.
That was a clear explanation.
and thanks for the solution to my query too.
# 6  
Old 08-10-2009
Thanks Scott for helping.
but when i tried it with '*' it doesnt worked.
# 7  
Old 08-10-2009
Please show the command you run, and the error, if any, or output you received.

Code:
 > echo \*
*
 > echo '*'
*
 > echo *
file1 file2

You can turn off the special meaning of * with "set -o noglob", or by running ksh with the -f flag. (these options actually turn off filename expansion by the shell. As you didn't tell me why it didn't work, I assumed that was the problem).

Last edited by Scott; 08-10-2009 at 11:28 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove first meta key from json records using shell

Hi All, I need to get rid of initial meta key from json files with enclosed parenthesis from start and end of the lines which has total 4000 lines. here is the sample Json records : {"start": true, "meta": {"name": "xyz", "creation": "2017-07-14T16:20:06.000+02:00"}} I need to remove... (7 Replies)
Discussion started by: Cloud_Ninja
7 Replies

2. Homework & Coursework Questions

Meta charcters

find out lines in a given file consisting of the following pattern BCAA, BCAAA, BCAAAA, BCAAAAA, BCAAAAAA (1 Reply)
Discussion started by: Phaneendra G
1 Replies

3. UNIX for Dummies Questions & Answers

Meta charcters

Find out lines in a given file consisting of the following pattern BCAA, BCAAA, BCAAAA, BCAAAAA, BCAAAAAA (0 Replies)
Discussion started by: Phaneendra G
0 Replies

4. Solaris

Meta Devices ( Metadb )

Hi All, I have two disks which has been configured for RAID 1 Already. I am adding more 6 disks in the system and I am configuring RAID 1 for all. So in this case should , how should i create a metadb . Thanks and Regards Rj (3 Replies)
Discussion started by: jegaraman
3 Replies

5. Solaris

What is Meta Database ?

Hi Guys, what is a meta file system ? what is it use for? What is /etc/vfstab? What is the relationship between the "vfstab file and meta file system. (3 Replies)
Discussion started by: tlee
3 Replies

6. Solaris

What is Meta Database ?

Hi Guys, what is a meta file system ? what is it use for? What is /etc/vfstab? What is the relationship between the "vfstab file and meta file system. thanks (1 Reply)
Discussion started by: tlee
1 Replies

7. Solaris

Meta Devices

I have added a sun storage array from a faiulty server onto a new server and copied the md.conf files etc. I can now access the /dev/md/dsk file systems, but I want to delete some metadevices that do not exist (it still thinks the 0 and 1 (root /var /export) disk are mirrored. How do I do this? (8 Replies)
Discussion started by: ozzmosiz
8 Replies

8. UNIX for Advanced & Expert Users

info regarding meta device

What is the quickest way to get partition / slices / hard disk / controller information regarding meta devices (md) on solaris 8. Thanks in advance. (4 Replies)
Discussion started by: Hitesh Shah
4 Replies
Login or Register to Ask a Question