- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Very simplistic script not working
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
Forums
Discussions
Discussions
Discussions
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
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
10-02-2005 11:20 PM
10-02-2005 11:20 PM
#!/bin/ksh
#
dd=`date '+%d'`
mm=`date '+%m'`
yy=`date | awk '{print $6}'`
#
echo "The current day is $dd"
echo "The current month is $mm"
echo "The current day is $yy"
#
sapfn="SAP_PAYROLL_FILE_$yy$mm$dd_$mm$yy.CSV"
echo $sapfn
The output from this script is not evaluating $dd and the underscore (_) within $sapfn properly..... this is the output :
The current day is 03
The current month is 10
The current year is 2005
SAP_PAYROLL_FILE_200510102005.CSV
Any idea why the variable $dd and the _ is not being evaulated correctly within $sapfn ?
Many thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2005 11:26 PM
10-02-2005 11:26 PM
Re: Very simplistic script not working
# sapfn="SAP_PAYROLL_FILE_$(date +'%Y%m%d_%m%Y').CSV"
# echo $sapfn
SAP_PAYROLL_FILE_20051003_102005.CSV
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2005 11:30 PM
10-02-2005 11:30 PM
Re: Very simplistic script not working
sapfn="SAP_PAYROLL_FILE_$yy$mm$dd_$mm$yy.CSV"
$dd_$mm --> Trying to treat as $dd as variable and _ is not detecting. You remove that as,
sapfn="SAP_PAYROLL_FILE_$yy$mm${dd}_$}mm}$yy.CSV"
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2005 11:30 PM
10-02-2005 11:30 PM
Re: Very simplistic script not working
#!/bin/ksh
#
dd=`date '+%d'`
mm=`date '+%m'`
yy=`date | awk '{print $6}'`
#
echo "The current day is $dd"
echo "The current month is $mm"
echo "The current day is $yy"
#
sapfn="SAP_PAYROLL_FILE_$yy$mm$dd"
sapfnex="_$mm$yy.CSV"
echo "$sapfn$sapfnex"
tmp# ./d
The current day is 03
The current month is 10
The current day is 2005
SAP_PAYROLL_FILE_20051003_102005.CSV
HTH,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2005 11:31 PM
10-02-2005 11:31 PM
Re: Very simplistic script not working
You can avoid variable name versus variable substitution ambiquity by enclosing the variable names in curly braces, like this:
sapfn="SAP_PAYROLL_FILE_${yy}${mm}${dd}_${mm}${yy}.CSV"
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2005 11:50 PM
10-02-2005 11:50 PM
Solutiontry to take a little bit care while using
and naming variable...
For example;
dd=`date '+%d'`
and please try to see man page of dd.
"dd" is one the unix command so system may
easily mixe it...
:-)
Good Luck,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2005 11:50 PM
10-02-2005 11:50 PM
Re: Very simplistic script not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2005 11:59 PM
10-02-2005 11:59 PM
Re: Very simplistic script not working
:-(