passing variable to script

how can i pass my dynamic variable from command to script?
example:

/sys script run MYSCRIPT MYVARIABLE

(MYVARIABLE can be dynamic like user1 or user2 etc)

IMHO the only way is to use global variables

http://forum.mikrotik.com/t/parameters-for-scripting/20266/1

Thank you for your reply. I already read that before posting, but its not a neat solution. I wanted to pass simple variable like we do in bash.
Example:

/sys scr run Myscript username1
/sys scr run Myscript username2

and so on to query some customized info using same script to pull specific users info.
Y its so hard to add this simple task in the MT Scripting :confused:

Create global variable with some value (username1)

:global variable username1

Use $variable in your script. When you need, simply change the value of specified variable:

:global variable username2

This way you will be able to run same script, by only changing one variable.

You can also use functions.

Ok I got it. Every time i have to change the global variable first, then run the script. two steps burden :slight_smile:

All of you, Thank you for your support and suggestions