.. index:: single: $ $ = A robust sub shell for powershell -------------- :: Version : 1.0 File Name : $.ps1 Author : Adewale Azeez - iamthecarisma@gmail.com Date : Apr-09-2020 -------------- Support inline execution, sub shell and shebang line execution. Hebang execution also :). The hebang line is similar to shebang just that instead of ‘#’ it expect ‘//’. The value of {0} is the full path to the file and can be used in the shebang and hebang line. The hebang can be used to compile a file before executing it. e.g the following c source file is compiled then executed, test.c :: //!gcc {0} -o test; ./test #include int main() { printf("hello world"); } Then execute this in the CLI. The file test.c will be compile and executed. The hebang line will expands to ``gcc C:/full/path/test.c -o test; ./test`` :: $ ./test.c will prints ‘hello world’ in the console. This also regocnize the webang line which allo the use of C89/C90 comment for file execuition e.g. :: /*!gcc {0} -o test; ./test */ #include int main() { printf("hello world for webang"); } Then execute this in the CLI. The file test.c will be compile and executed. The webang line will expands to ``gcc C:/full/path/test.c -o test; ./test`` :: $ ./test.c will prints ‘hello world for webang’ in the console. If no command is specified to the script it will enter a subshell where command can be executed line by line. The subshell is simply a powershell REPL which evaluates shebang, webang and hebang line in file if specified. Syntax ------ .. code:: powershell $ [[-Commands] ] [] Parameters ---------- -Commands :String[] ~~~~~~~~~~~~~~~~~~~ the commands to execute or the file to execute =========================== ===== attr value =========================== ===== Required? false Position? 1 Default value Accept pipeline input? false Accept wildcard characters? false =========================== ===== CommonParameters ~~~~~~~~~~~~~~~~ This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). Inputs ------ [System.String[]] Outputs ------- System.String EXAMPLE 1 --------- :: $ Enter the powershell sub shell which evaluates shebang and hebang line. EXAMPLE 2 --------- :: $ echo 'this is it' Prints ‘this is it’ in the console Related links ------------- - https://thecarisma.github.io/Cronux