Команды SFK


    1        2        3        4        5        6        7        8        9        10    

Раздел 7. Scripting - Скрипты
alias | batch | call | cd | clock | color | echo | for | getcwd | label | loop | mkcd | pause | require | setvar | sleep | stop | storetext | tee | time | tofile | toterm |

Help:   Рус   |   Eng        Refer:   Рус   |   Eng  

Команда: setvar
sfk setvar name[=value]

   store data in an sfk internal variable
   for later use in subsequent chain commands.

   all variable contents are lost when sfk exits.
   sfk does not set any environment variables.

   options
     -spat      support slash patterns
     -noline    with addtovar: do not append
                extra linefeeds
     -debug     tell what is done

   aliases
      addtovar       append chain text as lines
                     to existing variable text

   see also
      sfk help var   how to use sfk variables
      sfk getvar     print variable(s)

   web reference
      http://stahlworks.com/sfk-helpvar

   examples
      sfk setvar a="foo bar" +echo -var "test: #(a)"
         set variable a directly with a given string
         then use it in another command.
      sfk echo foo +setvar a +getvar
         set variable a with text line(s) passed from
         a previous command, then list all variables.
      sfk setvar -spat a="foo \qbar\q goo" +getvar
         set a string containing quotes.
      sfk -var setvar a=foobar +setvar a="#(substr(a,3))" +getvar
         drop first 3 chars of variable 'a', with simple text.
      sfk -var setvar -spat a=foo\qbar +setvar a="#(substr(a,3))"
         fails because text of a contains double quotes "".
      sfk -var setvar -spat a=foo\qbar
       +getvar a +xed "/[start][3 chars]//" +setvar a +getvar
         drop first 3 chars of 'a' safely, even with quotes.