- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Conditional alias and/or command
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-08-2006 01:32 AM
тАО06-08-2006 01:32 AM
Anyone?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-08-2006 01:45 AM
тАО06-08-2006 01:45 AM
Re: Conditional alias and/or command
test1()
{
var="b"
}
test2()
{
var="c"
}
var="a"
echo $var
test1
echo $var
test2
echo $var
would produce
a
b
c
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-08-2006 02:04 AM
тАО06-08-2006 02:04 AM
Re: Conditional alias and/or command
#!/usr/bin/ksh
function cmdA ()
{
if [ $DEBUG -eq 1 ]
then
CMD='set -x'
else
CMD=':'
fi
}
function cmdB
{
CMD='echo $$'
}
# Start of script
CMD=":"
#
# execute cmdB
cmdB
# Now execute what was assigned in cmdB
??????? <- this is what I'm interested in.
# execute cmdA
DEBUG=0
cmdA
# Now execute... as above
?????????
# execute cmdA
DEBUG=1
cmdA
# Now execute... as above
???????
exit 0
SO, what do I use in place of the ????? above.
Should it be
$CMD or `"$CMD"` or OR or...... maybe this will clarify what I'm actually asking.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-08-2006 02:57 AM
- Tags:
- eval
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-08-2006 03:21 AM
тАО06-08-2006 03:21 AM
Re: Conditional alias and/or command
JM