Ring/Lessons/System Functions

System Functions
In this chapter we are going to learn about the system functions


 * System


 * Get


 * IsMSDOS


 * IsWindows


 * IsWindows64


 * IsUnix


 * IsMacOSX


 * IsLinux


 * IsFreeBSD


 * IsAndroid


 * Windowsnl


 * Get Command Line Arguments


 * Get Active Source File Name

System Function
We can execute system commands using the system function

Syntax:

Example:

Get Function
We can get environment variables using the Get function

Syntax:

Example:

IsMSDOS
We can check if the operating system is MSDOS or not using the IsMSDOS function

Syntax:

IsWindows
We can check if the operating system is Windows or not using the IsWindows function

Syntax:

IsWindows64
We can check if the operating system is Windows 64bit or not using the IsWindows64 function

Syntax:

IsUnix
We can check if the operating system is Unix or not using the IsUnix function

Syntax:

IsMacOSX
We can check if the operating system is Mac OS X or not using the IsMacOSX function

Syntax:

IsLinux
We can check if the operating system is Linux or not using the IsLinux function

Syntax:

IsFreeBSD
We can check if the operating system is FreeBSD or not using the IsFreeBSD function

Syntax:

IsAndroid
We can check if the operating system is Android or not using the IsAndroid function

Syntax:

Example
Output:

Windowsnl
We can get the windows new line string using the Windowsnl function.

Syntax:

Example:

if iswindows cStr = substr(cStr,windowsnl,nl) ok

aList = str2list(cStr) # to do - list items processing using "for in" cStr = list2str(aList)

if iswindows cStr = substr(cStr,nl,windowsnl) ok

write("ouput.txt",cStr)

Get Command Line Arguments
We can get the command line arguments passed to the ring script using the sysargv variable.

The sysargv variable is a list contains the command line parameters.

Example

Output

Get Active Source File Name
We can get the active source file name (*.ring) using the filename function

Syntax:

Example:

Output:

Example: