SunQuest
           UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 7th, 2004, 01:00 AM
chess chess is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 9 chess User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Changing variable value in trap

Hi,
I was trying to change a value of a variable in trap like this
trap 'display_prev_menu; start=1' 1 2 3 6 15 20

But itseems like the value doesn't actually get set to 1. It stays as what ever it was before. Can anyone help me with this pls.

Thanx

Reply With Quote
  #2  
Old July 7th, 2004, 04:35 AM
murugesan murugesan is offline
Dinesh_P_V
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: India
Posts: 256 murugesan New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 11 h 38 m
Reputation Power: 0
Send a message via Yahoo to murugesan
I am able to get it.

Code:
#!/bin/sh
# FILE NAME : tmpr.sh
display_prev_menu()
{
        start=12
        echo display_prev_menu : $start
}
start=100
echo "start initial value: " $start
trap 'display_prev_menu;start=1;echo Trap start value : $start' 1 2 3 6 15 20
kill `ps -ex | grep tmpr.sh | grep -v grep | awk '{print $1}'`


My guess is that the start variable might have been changed at some other location in your script.
To check whether it has been set / not, try echo within the trap itself.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Changing variable value in trap


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway