#!/bin/sh

#
#get the platform
#SWBD10 is Ulysess
#
getSWBD()
{
	_abc=`/sbin/sin | \
		  /bin/grep Platform | \
		  /usr/bin/cut -d" " -f2 | \
		  /usr/bin/cut -d"," -f1`
	echo $_abc
}
product=`getSWBD`

#Please add commands in the aplhabetical order
#If commands have to be grouped based on functionality,
#and can not maintain alphabetical order with respect
#to rest of the commands, you can make an exception.

#Commands need not be in alphabetical order any more.
#and need not be unique too.
#IMPORTANT: if the command explanation exceeds one line (80 chars)
#You can break it in to more than oneline by adding "%" for "\n" 
#and "@" for "\t". 
#f.e
#httpcfgSet		used  to  set the version of the Java plug-in used %@@@by the Webtools
#Will be displayed as
#httpcfgSet		used  to  set the version of the Java plug-in used 
#			by the Webtools
#

PATH="/fabos/sbin"
usage() {
    echo "Usage: `basename $0` [ command ]"
    exit 1
}

if [ "$product" = "SWBD10" ] ; then

SHELL_STANDBY_HELP="

date                    Print/set the system date and time
errClear		Clear error log
errDump                 Print error log (no page breaks)
errShow			Print error log (with page breaks)
errNvLogSizeShow	show persistent error log configuration
fastboot                Reboot this switch, bypassing POST
firmwareCommit          Commit firmware to stable storage
firmwareDownload        Download firmware into switch
firmwareRestore		Restore the old firmware in the switch
firmwareShow		Display firmware versions in the switch
firmwareDownloadStatus	Display the progress and status of firmwareDownload
errSaveLvlShow		Get error save level
h                       Print shell history
help                    Print this list
haShow                  Print High availability status
ifModeSet		Set the link operating mode for a network interface
ifModeShow		Display the link operating mode for a network interface
killtelnet		Terminate telnet/serial login sessions interactively
login			Login as a new user
logout			Logout from remote session
memshow			Display memory usage in the system.
reboot                  Reboot this processor 
savecore                FTP or Remove core files generated by daemons
timeout			set/show the IDLE timeout value for a login session
uptime                  Print how long switch has been up
version                 Print firmware version
errSaveLvlSet		set error save level
errNvLogSizeSet		resize non-volatile (persistent) error log
myid                    Display the current login session details"

else

SHELL_STANDBY_HELP="
date                    Print/set the system date and time
errClear		Clear error log
errDump                 Print error log  (no page breaks)
errNvLogSizeShow	show persistent error log configuration
fastboot                Reboot this switch, bypassing POST
firmwareCommit          Commit firmware to stable storage
firmwareDownload        Download firmware into switch
firmwareRestore		Restore the old firmware in the switch
firmwareShow		Display firmware versions in the switch
firmwareDownloadStatus	Display the progress and status of firmwareDownload
errSaveLvlShow		Get error save level
h                       Print shell history
help                    Print this list
ifModeSet		Set the link operating mode for a network interface
ifModeShow		Display the link operating mode for a network interface
killtelnet		Terminate telnet/serial login sessions interactively
memshow			Display memory usage in the system.
reboot                  Reboot this processor 
savecore                FTP or Remove core files generated by daemons
timeout			set/show the IDLE timeout value for a login session
uptime                  Print how long switch has been up
version                 Print firmware version
errSaveLvlSet		set error save level
errNvLogSizeSet		resize non-volatile (persistent) error log
myid                    Display the current login session details"

fi

SHELL_FACTORY_HELP="
cmwrrd                  Central memory read/write debug utility
cmscan                  Central memory scanning debug utility
cmread                  Central memory read debug utility
cmwrite                 Central memory write debug utility
configRemoveAll		Removes all configuration data from switch
forceerror              Insert message into burnin log
forceporterror          Insert port message into burnin log
fruInfoSet		sets data in FRU Header
historyClear		clear the history log
historyMode		display or set the mode of the history log
httpcfgSet		used  to  set the version of the Java plug-in used %@@@by the Webtools
ptsetlb                 Test port loopback operation
setclbdebug             Test cable loopback operation
setLabMode		set lab mode
stestbisr               BISR factory diagnostic utility
stestcam                Quickloop CAM factory diagnostic utility
stestcmbisr             Central memory BISR subtest
stestcmbuferr           Central memory buffer error subtest
stestcmchperr           Central memory chip error subtest
stestcmconn             Central memory Conn subtest
stestcmparerr           Central memory parity error subtest
stestcmsmi              Central memory SMI subtest
stestcmwr               Central memory read/write subtest
stestcmi                CMI bus connection factory diagnostic utility
timeout			set/show the IDLE timeout value for a login session
voltShow		displays voltage sensors
wwn			display or set the world wide name"

#when you add a command for user, also add it under SHELL_ADMIN_HELP
#and SHELL_ROOT_HELP

if [ "$product" = "SWBD10" ] ; then

SHELL_USER_HELP="
agtcfgShow              Print SNMP agent configuration
aliasShow               Print Alias Server information
bcastShow		display broadcast routing information
chassisName		display the chassis's name
chassisShow		display all Field Replaceable Units (FRU)
date                    Print/set the system date and time
dlsShow			display the state of the dynamic load sharing option
errDump                 Print error log (no page breaks)
errNvLogSizeShow	show persistent error log configuration
errShow                 Print error log
fabricShow              Print fabric membership info
fanShow                 Print fan status
gbicShow                Print Serial ID GBIC information
errSaveLvlShow		Get error save level
h                       Print shell history
help                    Print this list
historyLastShow		displays last history record
historyShow		displays entire history log
interfaceShow		display the FSPF (TM) interface information
iodShow			display the state of the in-order delivery option
killtelnet		Terminate telnet/serial login sessions interactively
linkcost		set or print the FSPF cost of a link
login                   Login as a new user
logout                  Logout from remote session
LSDBShow		display the FSPF (TM) Link State Database
mcastShow		display multicast routing information
memshow			Display memory usage in the system.
msPlatShow              Display the Management Server Platform Database
msPlatShowDBCB          Display the Management Server Database Control Block
msTdReadConfig	        Display status of Management Server Topology %@@@Discovery Service
msCapabilityShow        Display Management Server Capability.
myid                    Display the current login session details
nbrStateShow		display FSPF (TM) neighbors' states
nsAllShow               Print global Name Server information
nscamShow               Print local Name Server Cache information
nsShow                  Print local Name Server information
nsStatShow              Display local Name Server Statistical information
passwd                  Set usernames and passwords
portAlpaShow		Show the ALPAs of a port
portCfgShow             Displays port configuration settings.
portErrShow             Print port error summary
portFlagsShow           Display the port status bitmaps of all ports in a %@@@switch
portLogDump             Print port log (no page breaks)
portLogDumpPort         Print port log (no page breaks)
portLogShow             Print port activity log
portLogShowPort         Print port activity log
portPerfShow            Print port throughput numbers
portShow                Print state of specified port
portRouteShow           Display various routing tables for a port
portStatsShow           Print hardware statistics
portStats64Show         Display the 64-bit hardware statistics for a port
powerOffListShow	displays slot power off list order
psShow                  Print power supply status
sfpShow                 Print Serial ID SFP information
sensorShow		display sensor readings
slotShow		Displays slot status
switchName              Print this switch's name
switchShow              Print switch and port status
switchStatusPolicyShow  Print policy parameters for overall switch status
switchStatusShow        Print overall switch status
switchUptime		Display the amount of time for which the switch is up
tempShow                Print temperature readings
timeout			set/show the IDLE timeout value for a login session
topologyShow		display the unicast fabric topology
trunkShow		Display trunking information
uptime                  Print how long switch has been up
version                 Print firmware version
wwn			display the world wide name"

else

SHELL_USER_HELP="
agtcfgShow              Print SNMP agent configuration
aliasShow               Print Alias Server information
bcastShow		display broadcast routing information
chassisName		display the chassis's name
chassisShow		display all Field Replaceable Units (FRU)
date                    Print/set the system date and time
dlsShow			display the state of the dynamic load sharing option
errDump                 Print error log (no page breaks)
errNvLogSizeShow	show persistent error log configuration
errShow                 Print error log
fabricShow              Print fabric membership info
fanShow                 Print fan status
errSaveLvlShow		Get error save level
h                       Print shell history
help                    Print this list
historyLastShow		displays last history record
historyShow		displays entire history log
interfaceShow		display the FSPF (TM) interface information
iodShow			display the state of the in-order delivery option
killtelnet		Terminate telnet/serial login sessions interactively
linkcost		set or print the FSPF cost of a link
login                   Login as a new user
logout                  Logout from remote session
LSDBShow		display the FSPF (TM) Link State Database
mcastShow		display multicast routing information
memshow			Display memory usage in the system.
msPlatShow              Display the Management Server Platform Database
msPlatShowDBCB          Display the Management Server Database Control Block
msTdReadConfig	        Display status of Management Server Topology %@@@Discovery Service
msCapabilityShow        Display Management Server Capability.
myid                    Display the current login session details
nbrStateShow		display FSPF (TM) neighbors' states
nsAllShow               Print global Name Server information
nscamShow               Print local Name Server Cache information
nsShow                  Print local Name Server information
nsStatShow              Display local Name Server Statistical information
passwd                  Set usernames and passwords
portAlpaShow		Show the ALPAs of a port
portCfgShow             Displays port configuration settings.
portErrShow             Print port error summary
portFlagsShow            Display the port status bitmaps of all ports in a %@@@switch
portLogDump             Print port log (no page breaks)
portLogDumpPort         Print port log (no page breaks)
portLogShow             Print port activity log
portLogShowPort         Print port activity log
portPerfShow            Print port throughput numbers
portShow                Print state of specified port
portRouteShow           Display various routing tables for a port
portStatsShow           Print hardware statistics
portStats64Show         Display the 64-bit hardware statistics for a port
psShow                  Print power supply status
sfpShow                 Print Serial ID SFP information
sensorShow		display sensor readings
switchName              Print this switch's name
switchShow              Print switch and port status
switchStatusPolicyShow  Print policy parameters for overall switch status
switchStatusShow        Print overall switch status
switchUptime		Display the amount of time for which the switch is up
tempShow                Print temperature readings
timeout			set/show the IDLE timeout value for a login session
topologyShow		display the unicast fabric topology
trunkShow		Display trunking information
uptime                  Print how long switch has been up
version                 Print firmware version
wwn			display the world wide name"

fi

#when you add a command for admin, also add it under SHELL_ROOT_HELP
if [ "$product" = "SWBD10" ] ; then

SHELL_ADMIN_HELP="
agtcfgDefault           Reset SNMP agent to factory default
agtcfgSet               Set SNMP agent configuration
agtcfgShow              Print SNMP agent configuration
aliasShow               Print Alias Server information
aliasDelete             Deletes a port from all local groups
aliasJoin 	        Creates a group of N-Ports
aliasPurge 	        Removes an alias group
bcastShow		display broadcast routing information
bladeDisable		Disable the blade
bladeEnable		Enable the blade
bladeBeacon		Set blade beaconing mode on or off
chassisShow		display all Field Replaceable Units (FRU)
chassisName		display or set the chassis's Name
configDefault           Reset config to factory default
configDownload          Load switch config from a server
configShow              Print switch config parameters
configUpload            Save switch config to a server
configure               Set switch config parameters
date                    Print/set the system date and time
dlsReset		turn off the dynamic load sharing (DLS) option
dlsSet			turn on the dynamic load sharing (DLS) option
dlsShow			display the state of the dynamic load sharing option
errClear		Clear error log
errDump                 Print error log (no page breaks)
errNvLogSizeSet		resize non-volatile (persistent) error log
errNvLogSizeShow	show persistent error log configuration
errSaveLvlSet		set error save level
errShow                 Print error log
fabricShow              Print fabric membership info
fanShow                 Print fan status
fanDisable		Disables a fan unit
fanEnable		Enables a fan unit
fastboot                Reboot this switch, bypassing POST
firmwareCommit          Commit firmware to stable storage
firmwareDownload        Download firmware into switch
firmwareRestore		Restore the old firmware in the switch
firmwareShow		Display firmware versions in the switch
firmwareDownloadStatus	Display the progress and status of firmwareDownload
gbicShow                Print Serial ID GBIC information
errSaveLvlShow		Get error save level
h                       Print shell history
haDisable		disable  the  High Availability feature in the switch
haEnable		enable  the  High  Availability  feature in the switch
haFailover              Forces the Standby CP to become Active CP
haShow                  Print High availability status
help                    Print this list
historyMode		displays history mode
historyLastShow		displays last history record
historyShow		displays entire history log
i			display process summary
ifModeSet		Set the link operating mode for a network interface
ifModeShow		Display the link operating mode for a network interface
interfaceShow		display the FSPF (TM) interface information
interopMode		Displays/enables/disables  Brocade  switch %@@@interoperability with switches from other manufacturers
iodReset		turn off the in-order delivery (IOD) option
iodSet			turn on the in-order delivery (IOD) option
iodShow			display the state of the in-order delivery option
ipAddrSet               Set ethernet and FC IP addresses
ipAddrShow              Print ethernet and FC IP addresses
killtelnet		Terminate telnet/serial login sessions interactively
ledtest			run LED diagnostics on a switch blade & WWNs
linkcost		set or print the FSPF cost of a link
login                   Login as a new user
logout                  Logout from remote session
LSDBShow		display the FSPF (TM) Link State Database
lutil			license administration utility
mcastShow		display multicast routing information
memshow			Display memory usage in the system.
msConfigure             Configure Management Server
msPlClearDB		Clear the Management Server Platform Database %@@@fabric-wide
msPlMgmtActivate	Activate the Management Server Platform Database %@@@fabric-wide
msPlMgmtDeactivate	Deactivate the Management Server Platform Database %@@@fabric-wide
msPlatShow              Display the Management Server Platform Database
msPlatShowDBCB          Display the Management Server Database Control Block
msTdEnable	        Enables the Management Server Topology Discovery %@@@Management Service
msTdDisable	        Disables the Management Server Topology Discovery %@@@Management Service
msTdReadConfig	        Display status of Management Server Topology %@@@Discovery Service
msCapabilityShow        Display Management Server Capability.
myid                    Display the current login session details
nbrStateShow		display FSPF (TM) neighbors' states
nbrStatsClear		reset the FSPF (TM) interface counters
nsAllShow               Print global Name Server information
nscamShow               Print local Name Server Cache information
nsShow                  Print local Name Server information
nsStatShow              Display local Name Server Statistical information
passwd                  Set usernames and passwords
portAlpaShow		Show the ALPAs of a port
portCfgDefault		Restore the port configuration to defaults
portCfgDelayFlogi       Configure a port to delay a FLOGI accept
portCfgLongDistance     Configure a Long Distance Port
portCfgMcastLoopback    Configure multicast loopback port
portCfgTrunkPort	Configure a port for trunking
portCfgSpeed 		Configure a port to a particular speed level
portCfgEport		Enable/Disable a port from becoming E_Port
portCfgGport		Lock a port as a G_Port
portCfgLport		Lock a port as a L_Port
portDisable             Disable a specified port
portEnable              Enable a specified port
portCfgShow             Displays port configuration settings.
portErrShow             Print port error summary
portFlagsShow           Display the port status bitmaps of all ports in a %@@@switch
portLogClear            Clear port activity log
portLogDump             Print port log (no page breaks)
portLogDumpPort         Print port log (no page breaks)
portLogShow             Print port activity log
portLogShowPort         Print port activity log
portPerfShow            Print port throughput numbers
portShow                Print state of specified port
portRouteShow           Display various routing tables for a port
portStatsShow           Print hardware statistics
portStats64Show         Display the 64-bit hardware statistics for a port
portStatsClear          Clear the status of a specified switch port
powerOffListSet		sets slot power off list order
powerOffListShow	displays slot power off list order
psShow                  Print power supply status
reboot                  Reboot all switches on this processor 
savecore                FTP or Remove core files generated by daemons
sensorShow		display sensor readings
sfpShow                 Print Serial ID SFP information
slotShow		Displays slot status
slotOn			Enables a blade slot
slotOff			Disables a blade slot
slotPowerOn		Powers on a blade unit
slotPowerOff		Powers off a blade unit
switchBeacon            Set switch beacon on or off
switchCfgTrunk		Configure all ports on the switch for trunking
switchCfgSpeed		Configures all ports of the switch to a particular %@@@speed level
switchDisable           Disable this switch
switchEnable            Enable this switch
switchName              Print/set this switch's name
switchReboot		Reboot the local switch
switchShow              Print switch and port status
switchShutDown		halt the operational switch
switchStart		initialize the switch to operational
switchStatusPolicySet   Set policy parameters for overall switch status
switchStatusPolicyShow  Print policy parameters for overall switch status
switchStatusShow        Print overall switch status
switchUptime		Display the amount of time for which the switch is up
snmpMibCapSet           Set options for configuring SNMP Mib/Trap Capability
syslogdIpAdd            Add syslog daemon IP address
syslogdIpRemove         Remove syslog daemon IP address
syslogdIpShow           Print the syslog daemon targets
tempShow                Print temperature readings
timeout			set/show the IDLE timeout value for a login session
topologyShow		display the unicast fabric topology
trunkDebug		Debug a trunk link failure
trunkShow		Display trunking information
uptime                  Print how long switch has been up
uRouteConfig		configure a static route
uRouteRemove		remove a static route
uRouteShow		display unicast routing information
version                 Print firmware version"

else

SHELL_ADMIN_HELP="
agtcfgDefault           Reset SNMP agent to factory default
agtcfgSet               Set SNMP agent configuration
agtcfgShow              Print SNMP agent configuration
aliasShow               Print Alias Server information
aliasDelete             Deletes a port from all local groups
aliasJoin 	        Creates a group of N-Ports
aliasPurge 	        Removes an alias group
bcastShow		display broadcast routing information
chassisShow		display all Field Replaceable Units (FRU)
chassisName		display or set the chassis's Name
configDefault           Reset config to factory default
configDownload          Load switch config from a server
configShow              Print switch config parameters
configUpload            Save switch config to a server
configure               Set switch config parameters
date                    Print/set the system date and time
dlsReset		turn off the dynamic load sharing (DLS) option
dlsSet			turn on the dynamic load sharing (DLS) option
dlsShow			display the state of the dynamic load sharing option
errClear		Clear error log
errNvLogSizeShow	show persistent error log configuration
errDump                 Print error log (no page breaks)
errShow                 Print error log
fabricShow              Print fabric membership info
fanShow                 Print fan status
fanDisable		Disables a fan unit
fanEnable		Enables a fan unit
fastboot                Reboot this switch, bypassing POST
firmwareCommit          Commit firmware to stable storage
firmwareDownload        Download firmware into switch
firmwareRestore		Restore the old firmware in the switch
firmwareShow		Display firmware versions in the switch
firmwareDownloadStatus	Display the progress and status of firmwareDownload
errSaveLvlShow		Get error save level
h                       Print shell history
help                    Print this list
historyLastShow		displays last history record
historyShow		displays entire history log
i			display process summary
ifModeSet		Set the link operating mode for a network interface
ifModeShow		Display the link operating mode for a network interface
interfaceShow		display the FSPF (TM) interface information
interopMode		Displays/enables/disables Brocade switch %@@@interoperability with switches from other manufacturers
iodReset		turn off the in-order delivery (IOD) option
iodSet			turn on the in-order delivery (IOD) option
iodShow			display the state of the in-order delivery option
ipAddrSet               Set ethernet and FC IP addresses
ipAddrShow              Print ethernet and FC IP addresses
killtelnet		Terminate telnet/serial login sessions interactively
ledtest			run LED diagnostics on a switch blade & WWNs
linkcost		set or print the FSPF cost of a link
login                   Login as a new user
logout                  Logout from remote session
LSDBShow		display the FSPF (TM) Link State Database
lutil			license administration utility
mcastShow		display multicast routing information
memshow			Display memory usage in the system.
msConfigure             Configure Management Server
msPlClearDB		Clear the Management Server Platform Database %@@@fabric-wide
msPlMgmtActivate	Activate the Management Server Platform Database %@@@fabric-wide
msPlMgmtDeactivate	Deactivate the Management Server Platform Database %@@@fabric-wide
msPlatShow              Display the Management Server Platform Database
msPlatShowDBCB          Display the Management Server Database Control Block
msTdEnable	        Enables the Management Server Topology Discovery %@@@Management Service
msTdDisable	        Disables the Management Server Topology Discovery %@@@Management Service
msTdReadConfig	        Display status of Management Server Topology %@@@Discovery Service
msCapabilityShow        Display Management Server Capability.
myid                    Display the current login session details
nbrStateShow		display FSPF (TM) neighbors' states
nbrStatsClear		reset the FSPF (TM) interface counters
nsAllShow               Print global Name Server information
nscamShow               Print local Name Server Cache information
nsShow                  Print local Name Server information
nsStatShow              Display local Name Server Statistical information
passwd                  Set usernames and passwords
portAlpaShow		Show the ALPAs of a port
portCfgDefault		Restore the port configuration to defaults
portCfgDelayFlogi       Configure a port to delay a FLOGI accept
portCfgLongDistance     Configure a Long Distance Port
portCfgMcastLoopback    Configure multicast loopback port
portCfgTrunkPort	Configure a port for trunking
portCfgSpeed 		Configure a port to a particular speed level
portCfgEport		Enable/Disable a port from becoming E_Port
portCfgGport		Lock a port as a G_Port
portCfgLport		Lock a port as a L_Port
portDisable             Disable a specified port
portEnable              Enable a specified port
portCfgShow             Displays port configuration settings.
portErrShow             Print port error summary
portFlagsShow            Display the port status bitmaps of all ports in a %@@@switch
portLogClear            Clear port activity log
portLogDump             Print port log (no page breaks)
portLogDumpPort         Print port log (no page breaks)
portLogShow             Print port activity log
portLogShowPort         Print port activity log
portPerfShow            Print port throughput numbers
portShow                Print state of specified port
portRouteShow           Display various routing tables for a port
portStatsShow           Print hardware statistics
portStats64Show         Display the 64-bit hardware statistics for a port
portStatsClear          Clear the status of a specified switch port
psShow                  Print power supply status
reboot                  Reboot all switches on this processor 
savecore                FTP or Remove core files generated by daemons
sensorShow		display sensor readings
errSaveLvlSet		set error save level
errNvLogSizeSet		resize non-volatile (persistent) error log
sfpShow                 Print Serial ID SFP information
switchBeacon            Set switch beacon on or off
switchCfgTrunk		Configure all ports on the switch for trunking
switchCfgSpeed		Configures all ports of the switch to a particular %@@@speed level
switchDisable           Disable this switch
switchEnable            Enable this switch
switchName              Print/set this switch's name
switchShow              Print switch and port status
switchStatusPolicySet   Set policy parameters for overall switch status
switchStatusPolicyShow  Print policy parameters for overall switch status
switchStatusShow        Print overall switch status
switchUptime		Display the amount of time for which the switch is up
snmpMibCapSet           Set options for configuring SNMP Mib/Trap Capability
syslogdIpAdd            Add syslog daemon IP address
syslogdIpRemove         Remove syslog daemon IP address
syslogdIpShow           Print the syslog daemon targets
tempShow                Print temperature readings
timeout			set/show the IDLE timeout value for a login session
topologyShow		display the unicast fabric topology
trunkDebug		Debug a trunk link failure
trunkShow		Display trunking information
uptime                  Print how long switch has been up
uRouteConfig		configure a static route
uRouteRemove		remove a static route
uRouteShow		display unicast routing information
version                 Print firmware version

diagHelp                Print diagnostic help info
fwHelp                  Print Fabric Watch help info
licenseHelp             Print license help info
perfHelp                Print Performance Monitoring help info
routeHelp               Print routing help info
trackChangesHelp        Print Track Changes help info
zoneHelp                Print zoning help info"

fi

#List of commands available to root
if [ "$product" = "SWBD10" ] ; then

SHELL_ROOT_HELP="
agtcfgDefault           Reset SNMP agent to factory default
agtcfgSet               Set SNMP agent configuration
agtcfgShow              Print SNMP agent configuration
aliasShow               Print Alias Server information
aliasDelete             Deletes a port from all local groups
aliasJoin 	        Creates a group of N-Ports
aliasPurge 	        Removes an alias group
bcastShow		display broadcast routing information
bladeDisable		Disable the blade
bladeEnable		Enable the blade
bladeBeacon		Set blade beaconing mode on or off
bladePropShow		display blade property
chassisName		display or set the chassis's Name
chassisShow		display all Field Replaceable Units (FRU)
configDefault           Reset config to factory default
configDownload          Load switch config from a server
configShow              Print switch config parameters
configUpload            Save switch config to a server
configure               Set switch config parameters
date                    Print/set the system date and time
dlsReset		turn off the dynamic load sharing (DLS) option
dlsSet			turn on the dynamic load sharing (DLS) option
dlsShow			display the state of the dynamic load sharing option
errClear		Clear error log
errDump                 Print error log (no page breaks)
errNvLogSizeShow	show persistent error log configuration
errShow                 Print error log
fabricShow              Print fabric membership info
fanShow                 Print fan status
fanDisable		Disables a fan unit
fanEnable		Enables a fan unit
fastboot                Reboot this switch, bypassing POST
firmwareCommit          Commit firmware to stable storage
firmwareDownload        Download firmware into switch
firmwareRestore		Restore the old firmware in the switch
firmwareShow		Display firmware versions in the switch
firmwareDownloadStatus	Display the progress and status of firmwareDownload
gbicShow                Print Serial ID GBIC information
errSaveLvlShow		Get error save level
h                       Print shell history
haDisable		disable  the  High Availability feature in the switch
haEnable		enable  the  High  Availability  feature in the switch
haFailover              Forces the Standby CP to become Active CP
haShow                  Print High availability status
help                    Print this list
historyLastShow		displays last history record
historyShow		displays entire history log
i			display process summary
ifModeSet		Set the link operating mode for a network interface
ifModeShow		Display the link operating mode for a network interface
interfaceShow		display the FSPF (TM) interface information
iodReset		turn off the in-order delivery (IOD) option
iodSet			turn on the in-order delivery (IOD) option
iodShow			display the state of the in-order delivery option
ipAddrSet               Set ethernet and FC IP addresses
ipAddrShow              Print ethernet and FC IP addresses
killtelnet		Terminate telnet/serial login sessions interactively
ledtest			run LED diagnostics on a switch blade & WWNs
linkcost		set or print the FSPF cost of a link
login                   Login as a new user
logout                  Logout from remote session
LSDBShow		display the FSPF (TM) Link State Database
lutil			license administration utility
mcastShow		display multicast routing information
memshow			Display memory usage in the system.
msConfigure             Configure Management Server
msPlClearDB		Clear the Management Server Platform Database %@@@fabric-wide
msPlMgmtActivate	Activate the Management Server Platform Database %@@@fabric-wide
msPlMgmtDeactivate	Deactivate the Management Server Platform Database %@@@fabric-wide
msPlatShow              Display the Management Server Platform Database
msPlatShowDBCB          Display the Management Server Database Control Block
msTdEnable	        Enables the Management Server Topology Discovery %@@@Management Service
msTdDisable	        Disables the Management Server Topology Discovery %@@@Management Service
msTdReadConfig	        Display status of Management Server Topology %@@@Discovery Service
msCapabilityShow        Display Management Server Capability.
myid                    Display the current login session details
nbrStatsClear		reset the FSPF (TM) interface counters
nbrStateShow		display FSPF (TM) neighbors' states
nsAllShow               Print global Name Server information
nscamShow               Print local Name Server Cache information
nsShow                  Print local Name Server information
nsStatShow              Display local Name Server Statistical information
passwd                  Set usernames and passwords
portAlpaShow		Show the ALPAs of a port
portCfgDefault		Restore the port configuration to defaults
portCfgDelayFlogi       Configure a port to delay a FLOGI accept
portCfgLongDistance     Configure a Long Distance Port
portCfgMcastLoopback    Configure multicast loopback port
portCfgTrunkPort	Configure a port for trunking
portCfgSpeed 		Configure a port to a particular speed level
portCfgEport		Enable/Disable a port from becoming E_Port
portCfgGport		Lock a port as a G_Port
portCfgLport		Lock a port as a L_Port
portDisable             Disable a specified port
portEnable              Enable a specified port
portCfgShow             Displays port configuration settings.
portErrShow             Print port error summary
portFlagsShow           Display the port status bitmaps of all ports in a %@@@switch
portLogClear            Clear port activity log
portLogDump             Print port log (no page breaks)
portLogDumpPort         Print port log (no page breaks)
portLogShow             Print port activity log
portLogShowPort         Print port activity log
portPerfShow            Print port throughput numbers
portShow                Print state of specified port
portRouteShow           Display various routing tables for a port
portStatsShow           Print hardware statistics
portStats64Show         Display the 64-bit hardware statistics for a port
portStatsClear          Clear the status of a specified switch port
powerOffListSet		sets slot power off list order
powerOffListShow	displays slot power off list order
psShow                  Print power supply status
reboot                  Reboot all switches on this processor 
savecore                FTP or Remove core files generated by daemons
sensorShow		display sensor readings
errSaveLvlSet		set error save level
errNvLogSizeSet		resize non-volatile (persistent) error log
sfpShow                 Print Serial ID SFP information
slotShow		Displays slot status
slotOn			Enables a blade slot
slotOff			Disables a blade slot
slotPowerOn		Powers on a blade unit
slotPowerOff		Powers off a blade unit
snmpMibCapSet           Set options for configuring SNMP Mib/Trap Capability
switchBeacon            Set switch beacon on or off
switchCfgTrunk		Configure all ports on the switch for trunking
switchDisable           Disable this switch
switchEnable            Enable this switch
switchName              Print/set this switch's name
switchReboot		Reboot the local switch
switchShow              Print switch and port status
switchShutDown		halt the operational switch
switchStart		initialize the switch to operational
switchStatusPolicySet   Set policy parameters for overall switch status
switchStatusPolicyShow  Print policy parameters for overall switch status
switchStatusShow        Print overall switch status
switchUptime		Display the amount of time for which the switch is up
syslogdIpAdd            Add syslog daemon IP address
syslogdIpRemove         Remove syslog daemon IP address
syslogdIpShow           Print the syslog daemon targets
tempShow                Print temperature readings
timeout			set/show the IDLE timeout value for a login session
topologyShow		display the unicast fabric topology
trunkDebug		Debug a trunk link failure
trunkShow		Display trunking information
uptime                  Print how long switch has been up
uRouteConfig		configure a static route
uRouteRemove		remove a static route
uRouteShow		display unicast routing information
version                 Print firmware version"

SHELL_SUBMENU_HELP="

diagHelp                Print diagnostic help info
fwHelp                  Print Fabric Watch help info
licenseHelp             Print license help info
perfHelp                Print Performance Monitoring help info
routeHelp               Print routing help info
trackChangesHelp        Print Track Changes help info
zoneHelp                Print zoning help info"

else

SHELL_ROOT_HELP="
agtcfgDefault           Reset SNMP agent to factory default
agtcfgSet               Set SNMP agent configuration
agtcfgShow              Print SNMP agent configuration
aliasShow               Print Alias Server information
aliasDelete             Deletes a port from all local groups
aliasJoin 	        Creates a group of N-Ports
aliasPurge 	        Removes an alias group
bcastShow		display broadcast routing information
bladePropShow		display blade property
chassisName		display or set the chassis's Name
chassisShow		display all Field Replaceable Units (FRU)
configDefault           Reset config to factory default
configDownload          Load switch config from a server
configShow              Print switch config parameters
configUpload            Save switch config to a server
configure               Set switch config parameters
date                    Print/set the system date and time
dlsReset		turn off the dynamic load sharing (DLS) option
dlsSet			turn on the dynamic load sharing (DLS) option
dlsShow			display the state of the dynamic load sharing option
errClear		Clear error log
errDump                 Print error log (no page breaks)
errNvLogSizeShow	show persistent error log configuration
errShow                 Print error log
fabricShow              Print fabric membership info
fanShow                 Print fan status
fanDisable		Disables a fan unit
fanEnable		Enables a fan unit
fastboot                Reboot this switch, bypassing POST
firmwareCommit          Commit firmware to stable storage
firmwareDownload        Download firmware into switch
firmwareRestore		Restore the old firmware in the switch
firmwareShow		Display firmware versions in the switch
firmwareDownloadStatus	Display the progress and status of firmwareDownload
fruInfoSet		sets data in FRU Header
errSaveLvlShow		Get error save level
h                       Print shell history
help                    Print this list
historyClear		clear the history log
historyMode		display or set the mode of the history log
historyLastShow		displays last history record
historyShow		displays entire history log
i			display process summary
ifModeSet		Set the link operating mode for a network interface
ifModeShow		Display the link operating mode for a network interface
interfaceShow		display the FSPF (TM) interface information
iodReset		turn off the in-order delivery (IOD) option
iodSet			turn on the in-order delivery (IOD) option
iodShow			display the state of the in-order delivery option
ipAddrSet               Set ethernet and FC IP addresses
ipAddrShow              Print ethernet and FC IP addresses
killtelnet		Terminate telnet/serial login sessions interactively
ledtest			run LED diagnostics on a switch blade & WWNs
linkcost		set or print the FSPF cost of a link
login                   Login as a new user
logout                  Logout from remote session
LSDBShow		display the FSPF (TM) Link State Database
lutil			license administration utility
mcastShow		display multicast routing information
memshow			Display memory usage in the system.
msConfigure             Configure Management Server
msPlClearDB		Clear the Management Server Platform Database %@@@fabric-wide
msPlMgmtActivate	Activate the Management Server Platform Database %@@@fabric-wide
msPlMgmtDeactivate	Deactivate the Management Server Platform %@@@Database fabric-wide
msPlatShow              Display the Management Server Platform Database
msPlatShowDBCB          Display the Management Server Database Control Block
msTdEnable	        Enables the Management Server Topology Discovery %@@@Management Service
msTdDisable	        Disables the Management Server Topology Discovery %@@@Management Service
msTdReadConfig	        Display status of Management Server Topology %@@@Discovery Service
msCapabilityShow        Display Management Server Capability.
myid                    Display the current login session details
nbrStatsClear		reset the FSPF (TM) interface counters
nbrStateShow		display FSPF (TM) neighbors' states
nsAllShow               Print global Name Server information
nscamShow               Print local Name Server Cache information
nsShow                  Print local Name Server information
nsStatShow              Display local Name Server Statistical information
passwd                  Set usernames and passwords
portAlpaShow		Show the ALPAs of a port
portCfgDefault		Restore the port configuration to defaults
portCfgDelayFlogi       Configure a port to delay a FLOGI accept
portCfgLongDistance     Configure a Long Distance Port
portCfgMcastLoopback    Configure multicast loopback port
portCfgTrunkPort	Configure a port for trunking
portCfgSpeed 		Configure a port to a particular speed level
portCfgEport		Enable/Disable a port from becoming E_Port
portCfgGport		Lock a port as a G_Port
portCfgLport		Lock a port as a L_Port
portDisable             Disable a specified port
portEnable              Enable a specified port
portCfgShow             Displays port configuration settings.
portErrShow             Print port error summary
portFlagsShow            Display the port status bitmaps of all ports in a %@@@switch
portLogClear            Clear port activity log
portLogDump             Print port log (no page breaks)
portLogDumpPort         Print port log (no page breaks)
portLogShow             Print port activity log
portLogShowPort         Print port activity log
portPerfShow            Print port throughput numbers
portShow                Print state of specified port
portRouteShow           Display various routing tables for a port
portStatsShow           Print hardware statistics
portStats64Show         Display the 64-bit hardware statistics for a port
portStatsClear          Clear the status of a specified switch port
psShow                  Print power supply status
reboot                  Reboot all switches on this processor 
savecore                FTP or Remove core files generated by daemons
sensorShow		display sensor readings
errSaveLvlSet		set error save level
errNvLogSizeSet		resize non-volatile (persistent) error log
sfpShow                 Print Serial ID SFP information
snmpMibCapSet           Set options for configuring SNMP Mib/Trap Capability
switchBeacon            Set switch beacon on or off
switchCfgTrunk		Configure all ports on the switch for trunking
switchDisable           Disable this switch
switchEnable            Enable this switch
switchName              Print/set this switch's name
switchShow              Print switch and port status
switchStatusPolicySet   Set policy parameters for overall switch status
switchStatusPolicyShow  Print policy parameters for overall switch status
switchStatusShow        Print overall switch status
switchUptime		Display the amount of time for which the switch is up
syslogdIpAdd            Add syslog daemon IP address
syslogdIpRemove         Remove syslog daemon IP address
syslogdIpShow           Print the syslog daemon targets
tempShow                Print temperature readings
timeout			set/show the IDLE timeout value for a login session
topologyShow		display the unicast fabric topology
trunkDebug		Debug a trunk link failure
trunkShow		Display trunking information
uptime                  Print how long switch has been up
uRouteConfig		configure a static route
uRouteRemove		remove a static route
uRouteShow		display unicast routing information
version                 Print firmware version
voltShow		displays voltage sensors

diagHelp                Print diagnostic help info
fwHelp                  Print Fabric Watch help info
licenseHelp             Print license help info
perfHelp                Print Performance Monitoring help info
routeHelp               Print routing help info
trackChangesHelp        Print Track Changes help info
wwn			display or set the world wide name
zoneHelp                Print zoning help info"

fi

#commands available to root account
shellRootHelp() {
echo "$SHELL_ROOT_HELP $SHELL_FACTORY_HELP" | /bin/sort -u -f | /usr/bin/tr "[%@]" "[\n\t]" | /usr/bin/less -P "Type <CR> or <SPACE BAR> to continue, <q> to stop" -e
echo "$SHELL_SUBMENU_HELP" 
}

#commands available on the standby cp
shellStandbyHelp() {
echo "$SHELL_STANDBY_HELP" | /bin/sort -u -f | /usr/bin/tr "[%@]" "[\n\t]" | /usr/bin/less -P "Type <CR> or <SPACE BAR> to continue, <q> to stop" -e
}

#commands available to the user account
shellUserHelp() {
echo "$SHELL_USER_HELP" | /bin/sort -u -f | /usr/bin/tr "[%@]" "[\n\t]" | /usr/bin/less -P "Type <CR> or <SPACE BAR> to continue, <q> to stop" -e
}

#commands available to the admin account
shellAdminHelp() {
echo "$SHELL_ADMIN_HELP" | /bin/sort -u -f | /usr/bin/tr "[%@]" "[\n\t]" | /usr/bin/less -P "Type <CR> or <SPACE BAR> to continue, <q> to stop" -e
echo "$SHELL_SUBMENU_HELP" 
}

#commands available to the factory account
shellFactoryHelp() {
echo "$SHELL_ADMIN_HELP $SHELL_FACTORY_HELP" | /bin/sort -u -f | /usr/bin/tr "[%@]" "[\n\t]" | /usr/bin/less -P "Type <CR> or <SPACE BAR> to continue, <q> to stop" -e
echo "$SHELL_SUBMENU_HELP" 
}

standby_profile=0
haShow > /dev/null
if [ $? -eq 1 ]; then
standby_profile=1
fi


if [ $# -gt 1 ]; then
    usage
elif [ $# -lt 1 ]; then
    if [ $standby_profile -eq 0 ]; then
	if [ "$LOGNAME" == "root" ]; then
		shellRootHelp
	elif [ "$LOGNAME" == "admin" ]; then
		shellAdminHelp
	elif [ "$LOGNAME" == "user" ]; then
		shellUserHelp
	elif [ "$LOGNAME" == "factory" ]; then
		shellFactoryHelp
	fi
    else
	shellStandbyHelp
    fi
else
     COMMAND=`echo $1 | /usr/bin/tr '[:upper:]' '[:lower:]'`
     exec /usr/bin/man -P "/usr/bin/less -P \"Type <CR> or <SPACE BAR> to continue, <q> to stop\" -e" $COMMAND 
fi
