HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Variable assignment in script
Operating System - HP-UX
1830201
Members
29931
Online
109999
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
11-11-2002 07:05 PM
11-11-2002 07:05 PM
Variable assignment in script
I have the following script:
#!/bin/ksh
d="/p05/oracle/migrate/sng"
a=$d"/source/*.pkh"
echo $a
echo "aa"$a
where /p05/oracle/migrate/sng/source has three files
file1.pkh, file2.pkh, file3.pkh
I expected echo $a to show
/p05/oracle/migrate/sng/source/*.pkh
but it show
/p05/oracle/migrate/sng/source/file1.pkh /p05/oracle/migrate/sng/source/file2.pkh /p05/oracle/migrate/hapay/source/file3.pkh
while $echo "aa"$a show
aa/p05/oracle/migrate/hapay/sng/*pkh
#!/bin/ksh
d="/p05/oracle/migrate/sng"
a=$d"/source/*.pkh"
echo $a
echo "aa"$a
where /p05/oracle/migrate/sng/source has three files
file1.pkh, file2.pkh, file3.pkh
I expected echo $a to show
/p05/oracle/migrate/sng/source/*.pkh
but it show
/p05/oracle/migrate/sng/source/file1.pkh /p05/oracle/migrate/sng/source/file2.pkh /p05/oracle/migrate/hapay/source/file3.pkh
while $echo "aa"$a show
aa/p05/oracle/migrate/hapay/sng/*pkh
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2002 07:25 PM
11-11-2002 07:25 PM
Re: Variable assignment in script
Steven,
I'd panic, because I have no clue where the directory
/p05/oracle/migrate/hapay
or how it came into play here. There's nothing in your script-ette that allows for that!
Was that a typo??
is it possible to see some actual output?
live free or die
harry
Live Free or Die
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2002 07:26 PM
11-11-2002 07:26 PM
Re: Variable assignment in script
Hi,
Your ksh script is expanding the '*' between the double quotes in your 'a' variable assignment. You can either escape the '*' like this:
a=${d}"/source/\*.pkh"
or you can turn off globbing in your script with the 'set -f' option.
Here is a quote from the ksh man page that explains a bit about what happens:
"File Name Generation
Following substitution, each command word is processed as a pattern for file name expansion unless the -f option has been set. The form of the patterns is the Pattern Matching Notation defined by regexp(5) . The word is replaced with sorted file names matching the pattern. If no file name is found that matches the pattern, the word is left unchanged."
JP
Your ksh script is expanding the '*' between the double quotes in your 'a' variable assignment. You can either escape the '*' like this:
a=${d}"/source/\*.pkh"
or you can turn off globbing in your script with the 'set -f' option.
Here is a quote from the ksh man page that explains a bit about what happens:
"File Name Generation
Following substitution, each command word is processed as a pattern for file name expansion unless the -f option has been set. The form of the patterns is the Pattern Matching Notation defined by regexp(5) . The word is replaced with sorted file names matching the pattern. If no file name is found that matches the pattern, the word is left unchanged."
JP
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP