- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to keep special meaning "*" inside a scrip...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2003 05:58 AM
тАО06-02-2003 05:58 AM
I want to execute the following command inside a script but it doesn't work because the special character "*" lose its special meaning inside a script.
...
if test -f /tmp/ffin*
...
Has anyone any idea?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2003 06:03 AM
тАО06-02-2003 06:03 AM
Re: How to keep special meaning "*" inside a script
Escape the asterisk with a backslash:
# touch /tmp/my\*file
# rm /tmp/my\*file
...are examples of this.
# if test -f /tmp/ffin\*
...would test for the presence of a file named '/tmp/ffin*'
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2003 06:04 AM
тАО06-02-2003 06:04 AM
Re: How to keep special meaning "*" inside a script
if [ -f "/tmp/ffin*"]
then.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2003 06:04 AM
тАО06-02-2003 06:04 AM
Re: How to keep special meaning "*" inside a script
..../tmp/ffin\* ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2003 06:15 AM
тАО06-02-2003 06:15 AM
Re: How to keep special meaning "*" inside a script
I just want to keep the meaning of "*".
I want to know if there are files with the pattern "ffin". For example, ffin0202.txt or ffin0304.txt, ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2003 06:15 AM
тАО06-02-2003 06:15 AM
Re: How to keep special meaning "*" inside a script
Hi,
\* will keep metacharacter"*" anywhere
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2003 06:17 AM
тАО06-02-2003 06:17 AM
Re: How to keep special meaning "*" inside a script
Another way is to use single quotes.
# touch '/tmp/my*file'
# rm '/tmp/my*file'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2003 06:21 AM
тАО06-02-2003 06:21 AM
Re: How to keep special meaning "*" inside a script
Use the backslash (\) before the *.
Regards,
DR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2003 06:24 AM
тАО06-02-2003 06:24 AM
Re: How to keep special meaning "*" inside a script
I resolved a similar question in
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xfc075ec05a7ad711abdc0090277a778c,00.html
try this:
if (ls /tmp/ffin* > /dev/null 2>&1) ; then echo Hi ; fi
Saludos
Frank.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2003 06:31 AM
тАО06-02-2003 06:31 AM
Re: How to keep special meaning "*" inside a script
..
if (($(ls /tmp/ffin*|wc -l) > 1))
...