; SH - A Named Variable Shell for ZCPR3 -- The Shell SH -- -- Handling Shell Variables -- S - The SH Command D - SHDEFINE C - SH Concept V - SHVAR P - Potential Probs -- SH Variable File -- F - SHFILE :S Command: SH 1.0 Syntax: SH Function: SÈ ió á Nameä Variablå Shelì foò ZCPR3® Iô promptó thå � useò  foò á commanä line¬  performó aî interpretatioî oî thå � commanä line¬ anä eitheò executeó thå commanä linå itselæ oò � passes the line on to the ZCPR3 Command Processor. Options: None Comments: Variables SÈ  permitó  thå  useò tï  uså  Nameä  Variables¬  likå � MYFILE¬  whicè arå expandeä iî á manneò similaò tï macroó iî � hió commanä lines®  Twï programs¬ SHDEFINÅ anä SHVAR¬ allo÷ � thå  useò  tï dynamicallù creatå Nameä  Variables¬  anä  thå � SHFILÅ  commanä  allowó  Nameä Variablå  definitionó  tï  bå � grouped into sets of variables. Á  conventionaì CP/Í commanä linå coulä looë  somethinç � likå this: ED MYFILE.TXT Using SH, a ZCPR3 command line like Variables ED %WORKFILE caî bå generated¬  and¬  aó SÈ substituteó thå definitioî oæ � thå  variablå WORKFILÅ wheî iô interpretó thå commanä  line¬ � "EÄ  %WORKFILE¢  coulä bå expandeä intï "EÄ  MYFILE.TXT¢  iæ � WORKFILE=MYFILE.TXT®  Bù changinç thå valuå oæ thå variablå � WORKFILE¬  thå  meaninç  oæ thå commanä  "EÄ  %WORKFILE¢  ió � correspondinglù changed. Oncå  SÈ  ió invokeä (bù typinç thå  commanä  SH)¬  anù � commanä typeä bù thå useò ió passeä thrõ SÈ first¬  expandeä � aó required¬  anä then¬ iæ thå commanä ió noô aî SH-residenô � command¬  thå  expandeä commanä linå ió passeä tï ZCPR³  foò � processing. SÈ  variableó maù bå nesteä tï anù  depth®  Recursion¬ � however¬  shoulä bå avoided¬ anä iô ió thå responsibilitù oæ � thå useò tï ensurå thaô recursioî doeó noô occur. Variables '%%§  ió  interpreteä  bù  SÈ  aó  á  singlå  '%'®  SÈ � variableó are assigneä aó follows: VAR1 = "ED %%VAR2" VAR2 = "MYFILE.TXT" VAR1 is expanded as "ED %VAR2" which is, in turn, expanded as "ED MYFILE.TXT" which is finally executed by being passed to ZCPR3. SH Commands There are three SH-resident commands: SHCMT - switch SH to run in comment mode; in comment mode, all lines which do not begin with the character ! are treated as comments and flushed SHECHO - with Echo enabled, all expanded command lines are printed to the user to show him what the line looked like after expansion SHEXIT - SH is popped from the Shell Stack, enabling the next lower Shell for execution The normal prompt for SH is: Comment Mode DU:NAME>> as opposed to: DU:NAME> foò  ZCPR3®  Iæ thå SHCMÔ (SÈ Comment© facilitù ió enabled¬ � this prompt becomes: DU:NAME; Anù  texô  issueä bù thå useò oò á commanä  filå  (likå � ZEX©  wilì  bå  processeä  aó á  commenô  unlesó  thå  firsô � characteò oæ thå linå ió aî exclamatioî marë (!)¬  whicè  ió � an indicator to process the command text that follows. Thå commanä SHCMÔ switcheó tï commenô mode¬  anä !SHCMÔ � switches back. Built-in Cmds Thå  SHECHÏ  commanä  ió alsï á  toggle¬  enablinç  anä � disablinç thå echï oæ commanä lineó afteò alì variableó havå � been resolved. Thå SHEXIÔ commanä causeó thå Shelì Stacë tï bå  poppeä � onå  level¬  whicè  iî  turî  causeó  thå  SÈ  Shelì  tï  bå � terminated since it was on the top of the stack. Botè  SHECHÏ anä SHEXIÔ caî bå executeä froí SÈ Commenô � mode by prefixing these commands with an exclamation mark. Thå ¿  commanä (á linå beginninç witè á quesitoî  mark© � invokeó  thå  built-iî  helð facilitù oæ  SH¬  whicè  simplù � reminds the user of what the built-in commands are for SH. Other Shells SÈ   ió  jusô  beginninç  oæ  thå  ZCPR³  Shelì   Stacë � applications® MENÕ anä VFILEÒ arå botè shelló now¬ anä theù � executå likå SH® Alì threå shelló caî pasó commanä lineó tï � ZCPR3¬  havå  ZCPR³  executå  theså commandó iî  itó  normaì � fashion¬  completå  witè thå command-searcè  hierarchy¬  anä � theî  returî tï thå appropriatå shelló wheî done®  Á  Shelì � imposeó  á  ne÷ initiaì commanä linå interpretatioî  oî  thå � inpuô commanä line. Selected Error Messages: "Nï Shelì Stack¢ meanó thaô á Shelì Stacë haó noô  beeî � installed in the ZCPR3 System and SH cannot run. "Shelì  Stacë Full¢ meanó thaô therå ió noô enougè rooí � on the Shell Stack for SH to push itself and SH cannot run. "Shelì  Stacë  Entrù Size¢ meanó thaô thå  shelì  stacë � entrieó  arå  toï shorô foò SÈ tï definå thå  parameteró  iô � needs to control its operation. SH cannot run. Examples of Use: SH -- SH is invoked :D Command: SHDEFINE 1.0 Syntax: SHDEFINE ufn <-- define variables within file or SHDEFINE <-- define variables within SH.VAR Function: SHDEFINÅ  allowó thå useò tï interactivelù displaù  anä � ediô  thå assignmenô oæ variableó iî á Shelì Variablå  file® � Hå maù add¬  delete¬ anä redefinå Shelì Variableó aó welì aó � lisô alì currenô definitionó oî thå CRÔ oò prinô theí oî thå � printer. Options: None Comments: Uså oæ SHDEFINÅ ió explaineä withiî thå prograí itself® � Iô  ió menu-driveî anä thå erroò anä instructionaì  messageó � arå intended to be clear. Thå  mosô compleø commanä ió thå Å (foò Edit©  command® � Afteò  issuinç  thió command¬  thå useò ió  prompteä  foò  á � variablå  name®  Iæ hå giveó thå namå oæ á variablå noô yeô � defined¬  thå  useò ió prompteä foò á  definition¬  anä  thå � variablå ió sï defineä unlesó thå useò respondeä witè jusô á � RETURΠ aô  thió  point®  Iæ thå namå oæ thå  variablå  haó � alreadù  beeî  defined¬  thå useò ió askeä iæ hå  wisheó  tï � deletå (D© oò redefinå (R© thå variable® Appropriatå actioî � is taken in response to the user input. The user must be a Wheel to run the SHDEFINE command. Selected Error Messages: Self-Explanatory Examples of Use: SHDEFINE myvars -- define variables in MYVARS.VAR :F Command: SHFILE 1.0 Syntax: SHFILE <-- display name of Shell Variable File or SHFILE ufn <-- set name of Shell Variable File Function: SHFILÅ displayó oò setó thå namå oæ thå Shelì  Variablå � Filå  tï bå useä bù SH®  SHFILÅ maù bå executeä whilå SÈ ió � not running if desired. Options: None Comments: SHDEFINÅ  anä SHVAÒ definå variableó tï bå placeä  intï � Shelì Variablå Files®  SHFILÅ defineó whicè Shelì  Variablå � File will be used by SH when it executes. Wheî SÈ anä SHVAÒ execute¬ thå nameä variablå filå theù � deaì witè resideó iî thå ROOÔ directory. Selected Error Messages: Self-Explanatory Examples of Use: SHFILE -- display name of Shell Variable File SHFILE myvars.var -- define name of Shell Variable File :V Command: SHVAR 1.0 Syntax: SHVAR <-- list variables or SHVAR var <-- delete variable or SHVAR var text <-- define/redefine variable Function: SHVAÒ  ió á utilitù whicè caî lisô alì Shelì  Variableó � iî  thå  currently-defineä Shelì Variablå Filå oò ediô  thió � filå tï deletå oò changå onå particulaò variablå aô á  time® � SHVAÒ  ió  sometimeó morå convenienô tï uså  thaî  SHDEFINE¬ � whicè  ió  intendeä foò editinç groupó oæ variableó  iî  onå � sitting. Options: None Comments: SHVAÒ maù bå useä whilå runninç SÈ oò not®  Iæ á Shelì � Variablå Filå ió alreadù defineä tï thå ZCPR³ System¬  SHVAÒ � uses this file. If one is not defined, SHVAR uses SH.VAR. SH.VAR is always located in the ROOT directory. The user must be a Wheel to run SHVAR. Selected Error Messages: Self-Explanatory Examples of Use: SHVAR -- list shell variables SHVAR VAR2 -- delete the variable VAR2 SHVAR VARX THIS IS A TEST -- define VARX to "THIS IS A TEST" :C SH Concept Oncå  SÈ  ió invokeä (bù typinç thå  commanä  SH)¬  anù � commanä typeä bù thå useò ió passeä thrõ SÈ first¬  expandeä � aó required¬  anä then¬ iæ thå commanä ió noô aî SH-residenô � command¬  thå  expandeä commanä linå ió passeä tï ZCPR³  foò � processing. SÈ  variableó maù bå nesteä tï anù  depth®  Recursion¬ � however¬  shoulä bå avoided¬ anä iô ió thå responsibilitù oæ � thå  useò  tï  ensurå thaô recursioî  doeó  noô  occur®  Iæ � recursioî doeó occur¬  thå commanä linå buffeò wilì overflo÷ � and SH will abort the command line. SÈ  Variableó  arå  referenceä  iî  commanä  lineó   aó � "%varname"¬  anä  '%%§ ió interpreteä bù SÈ aó á singlå '%'® � Tï  illustrate¬  assumå  thaô SÈ variableó arå  assigneä  aó � follows: VAR1 = "ED %%VAR2" VAR2 = "MYFILE.TXT" The command line "%VAR1" is expanded as "ED %VAR2" which is, in turn, is expanded as "ED MYFILE.TXT" which is finally executed by being passed to ZCPR3. Shelì  Variablå Fileó arå locateä iî thå ROOÔ directorù � for the commands SH and SHVAR. Thå  useò  musô  bå  á Wheeì iî  ordeò  tï  ediô  Shelì � Variablå Files®  Thå commandó SHDEFINÅ anä SHVAÒ wilì  onlù � run if the user is a Wheel. There are three SH-resident commands: SHCMT - switch SH to run in comment mode; in comment mode, all lines which do not begin with the character ! are treated as comments and flushed SHECHO - with Echo enabled, all expanded command lines are printed to the user to show him what the line looked like after expansion SHEXIT - SH is popped from the Shell Stack, enabling the next lower Shell for execution The normal prompt for SH is: DU:NAME>> as opposed to: DU:NAME> foò  ZCPR3®  Iæ thå SHCMÔ (SÈ Comment© facilitù ió enabled¬ � this prompt becomes: DU:NAME; Anù  texô  issueä bù thå useò oò á commanä  filå  (likå � ZEX©  wilì  bå  processeä  aó á  commenô  unlesó  thå  firsô � characteò oæ thå linå ió aî exclamatioî marë (!)¬  whicè  ió � an indicator to process the command text that follows. Thå commanä SHCMÔ switcheó tï commenô mode¬  anä !SHCMÔ � switches back. Thå  SHECHÏ  commanä  ió alsï á  toggle¬  enablinç  anä � disablinç thå echï oæ commanä lineó afteò alì variableó havå � been resolved. Thå SHEXIÔ commanä causeó thå Shelì Stacë tï bå  poppeä � onå  level¬  whicè  iî  turî  causeó  thå  SÈ  Shelì  tï  bå � terminated since it was on the top of the stack. Botè  SHECHÏ anä SHEXIÔ caî bå executeä froí SÈ Commenô � mode by prefixing these commands with an exclamation mark. Thå ¿  commanä (á linå beginninç witè á quesitoî  mark© � invokeó  thå  built-iî  helð facilitù oæ  SH¬  whicè  simplù � reminds the user of what the built-in commands are for SH. :P Potential Problems Onlù onå noteä probleí existó witè SH®  Certaiî ZCPR3-� residenô  anä  SYSRCP-residenô commandó shoulä  bå  avoided® � Theså commandó include: GO - because the TPA has been changed since the desired command executed SAVE - same reason SÈ   tendó  tï  bå  á  littlå  slo÷  iî  itó   loading® � Unfortunately¬  SÈ  haó  beeî madå aó smalì aó possiblå  anä � wilì  probablù  continuå  tï  takå  morå  timå  thaî  simplù � invoking the ZCPR3 command processor directly.