SYS - System call

(6/14/17)

PURPOSE

To access the operating system from SPIDER using a system (Unix) command. This is a synonym for the legacy 'VM' operation.   Example.

SEE ALSO

EV [Set system environmental variable]
VM [System call]

USAGE

.OPERATION: SYS
  <or>
SYS M
[For 'SYS M' multiline input is accepted until a line has only a intial '.' (dot). To put a blank at the end of a line, place it at the beginning of the following line or it will disappear.]

.SYSTEM COMMAND:   ls   *.OMM
[Enter the system command you want executed. This may also be a Unix shell command file.
Substitution of do-loop indices, symbolic and register variables is allowed anywhere in the command line.]

NOTES

  1. SPIDER comments are not accepted in the system command line because the SPIDER comment character (;) is used to string system commands together on the same line in Unix.

  2. You must specify the extension for any filenames within the system command as they are NOT appended automatically by SPIDER (as there is no way to recognize what is a filename). You can use the string: $DATEXT to substitute the current SPIDER data extension into the corresponding position in your command line. You can use the string: $PRJEXT to substitute the current SPIDER project extension into the corresponding position in your command line.

  3. Sample of substituting register variables in floating point format into a 'SYS' system command:

    [var] = 34.56

    SYS    ; To write out the following: Var is now= 34.5600
      echo Var is now= {%F7.4%[var]}

    SYS    ; To write out the following: Var is now= 3.4560E+01
      echo Var is now= {%ES11.4%[var]}

    Place the FORTRAN format within '%' symbols followed by the register whose contents are to be substituted. All of this has to be enclosed within the wavy brackets.

  4. Samples of substituting register variables in integer format into a 'SYS' system command:

    [var] = -1
    SYS    ; To write out the following: Var is now= -1
      echo Var is now= {%I3%[var]}


    [var] = 234
    SYS    ; To write out the following: Var is now= 234
      echo Var is now= {%I0%[var]}

  5. Sample of substituting string variables into a 'SYS' system command:

    [filename] = 'file.gnu'
    SYS    ; To write out the following: cat file.gnu
       cat [filename]

  6. Samples of usage within SPIDER loops.
     
     xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    -- Sample loop for converting series of gif images to JPEG format using Imagemagick:

    DO I=1,5 ; Loop SYS ; Use "Imagemagick" to convert images convert img{***i}.gif img{***i}.jpg ENDDO ; End loop

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    -- Sample loop for renaming/renumbering series of SPIDER images:

    [n]=33 DO I=1,4 ; Loop SYS ; System call for renumbering cp jnk{***[n]}.dat jnk444{***I}.dat [n]=[n]+1 ; Increment output file number counter ENDDO ; End loop

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    -- Sample loop for consecutively renaming/renumbering series of SPIDER -- images while skipping any missing image numbers:

    [num]=0 ; Initialize output file number counter DO [it]=1,4 ; Loop IQ FI [exists] ; Use "IQ FI" to see if file exists jnk{***[it]} ; Filename IF([exists].LE.0)CYCLE ; Skip if file not found [num]=[num]+1 ; Increment output file number counter SYS ; System call for renaming/renumbering SPIDER images cp jnk{***[it]}.dat jnk444{***[num]}.dat ENDDO ; End loop

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    -- Sample showing symbolic parameter substitution within a procedure:

    [var]=55 ; Set register variable outside of procedure ; (binding time for parameter substitution is ; before procedure is executed!) @testsys ; Invoke testsys SPIDER procedure doc ; Value given to: FILENAME PREFIX solicited ; by testsys procedure Contents of invoked procedure testsys: FR ?ENTER FILENAME PREFIX?[pre] SYS rm [pre]{***[var]}.$DATEXT Result of invoked procedure: rm doc055.DAT

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

SUBROUTINES

VMS

CALLER

DRIV1