how to avoid entering wildcards in a word


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to avoid entering wildcards in a word
# 1  
Old 06-16-2008
how to avoid entering wildcards in a word

Hi everybody,
im writing a bash script, and receiving entry from a user, and i need to check if the word has any wildcards in.
do u have any ideas please .

thanks .
# 2  
Old 06-16-2008
If a user enters a wildcard it will be globbed (expanded) by the shell. You will not see a wildcard in the result you read in.

Unless you turn off globbing in your script.
Code:
set -o noglob
read filename
-- check for wilcards or do something with filename here

set +o noglob

# 3  
Old 06-16-2008
Do not post questions without trying to solve the problem yourself based on your understanding. Post what have you tried so far and where exactly are you stuck?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Entering a newline into a header in awk

I want to create a header with awk like this: gawk 'BEGIN {print "List of Events"} Desired output: List of Events Tennis Baseball But I am at a loss on how to do this. I can make a list like this: List of Events Tennis Baseball But I can't get a space to appear. I have... (4 Replies)
Discussion started by: newbie2010
4 Replies

2. UNIX for Dummies Questions & Answers

Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word

I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL. I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies

3. Solaris

Login delay after entering id (40 secs) same after entering pw

Hi all, I have just installed Solaris 10 on an old Fujitsu Primepower 650 which has been wiped clean. I haven't installed anything apart from the OS yet, so the machine is 99% idle. I get long delays when logging in, first after entering the id then another long delay after entering a valid... (8 Replies)
Discussion started by: longjon
8 Replies

4. Shell Programming and Scripting

Entering into C shell remotely

Hi All, I want to enter into C shell from Ksh remotely. I have written code like, remsh $rHost -l $rUser -n "source $RM_HOME/run_time/.set_env.csh; jar -xvf $package.$extension" But it says; ksh: source : not found ksh: jar : not found Can anyone help me? Thanks. (1 Reply)
Discussion started by: AB10
1 Replies

5. Shell Programming and Scripting

Entering parameter automatically

First of all thank you for your replies to my earlier difficulties. Now I am facing another difficulty. I have written following “for” loop. For var in `find . -name “2008_reports*”` Do Gpg -symmetric ${var} Done When I use this loop it asks to enter pass phrase every time. Is there any... (7 Replies)
Discussion started by: anushree.a
7 Replies

6. Shell Programming and Scripting

Entering in to recent created folder

Hi, I had problem I have a script after each run, which creates a new folder under "testrun", I used to find recent createfolder by using ls -ltr in testrun folder. Is there any script which facilitates, going directly to recent createfolder under "testrun":confused: Plz help.. (7 Replies)
Discussion started by: prasad2k.java
7 Replies

7. Shell Programming and Scripting

Entering secret password

Hello All, I am trying to write a script when executed, asks you for the password, and confirm password; it should save to a file and also entered password should not be in clear text on the console - should be as **** Can somebody give me direction in writing this in shell? Thanks Chiru (4 Replies)
Discussion started by: chiru_h
4 Replies

8. UNIX for Dummies Questions & Answers

Running UNIX commands remotely in Windows box from Unix box – avoid entering password

I am able to run the UNIX commands in a Windows box from a UNIX box through "SSH" functionality. But whenever the SSH connection is established between UNIX and Windows, password for windows box is being asked. Is there a way to avoid asking password whenever the SSH connection is made? Can I... (1 Reply)
Discussion started by: D.kalpana
1 Replies

9. UNIX for Dummies Questions & Answers

Entering directories structured above user.

I wish to enter directories which are on the HD but not part of the user hierarchy and have access to the contents of an external HD. To an advanced user this is probably a stupid question but I experimented with ~, cd, . and.. to no avail. I did check for a suitable command but couldn't find one.... (9 Replies)
Discussion started by: Frank Hunter
9 Replies

10. UNIX for Dummies Questions & Answers

entering a long command

hello everyone! Very basic question for the guru's in here but anyways, I am trying to type a command that is longer than the line. What character do I use to continue my command on the next line? Thanks in advance.... Todd (1 Reply)
Discussion started by: hedrict
1 Replies
Login or Register to Ask a Question