- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script problem
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
07-04-2001 07:14 AM
07-04-2001 07:14 AM
I have a script wich call a script to get and use yesterdays date
from prompt
#./pastdate 1
#Jul 3 (note two spaces)
This is the output I require and this script works fine
When I call this script from my main script and echo out the result I get:-
#Jul 3 (note single space)
--------------From Script-----------
yestd=`/pastdate 1`
echo $yestD
------------------------------------
I require my output with the double space for dates less than 10 (as per std Unix date) so that I can use it to grep out credit card transaction carried out on a particular date.
So why is my date script correct when ran from the command prompt, but when it is called from within another script it presents the data with a space missing??
Help Please
Paula
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2001 07:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2001 07:32 AM
07-04-2001 07:32 AM
Re: Script problem
I can say what is the problem only if i see ur script.
But to avoid this u can insert following lines in ur script:
------------------------------------
mon=`echo $yestD | cut -d " " -f1`
day=`echo $yestD | cut -d " " -f2`
if [ $day -lt 10 ]
then
$yestD="$mon\ \ $day"
else
$yestD="$mon\ $day"
fi
-------------------------------------
Cheers...
Satish.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2001 07:33 AM
07-04-2001 07:33 AM
Re: Script problem
I use this date info as such;-
cat /avro/results |grep $yestD| awk (etc)
should this be used as:-
cat /avro/results |grep "$yestD"| awk (etc)
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2001 07:37 AM
07-04-2001 07:37 AM
Re: Script problem
Thanks that fixed it.
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2001 07:42 AM
07-04-2001 07:42 AM
Re: Script problem
That looks good to me! grep would treat look for the first word jul and think 3 was a file