12-11-2018, 05:53 PM
actually you can pass argument to the bash when you are using pipe to direct the downloaded file through stdin to the bash (which by the way is a child process with another pid. if you are already using bash shell then it will be a child. another bash shell. ps -AF --forest shows it all very nicely). you need -s
therefore it becomes
wget --no-check-certificate https://raw.githubusercontent.com/hidden...r/bench.sh -O - -o /dev/null | bash -s -- -b
or use /dev/stdin if available in system.
but direct piping like that is bad from security standpoint. you dont get to see things. only do when you know what you are doing and know the script thoroughly.
also not all script will work through piping. cause stdin is engaged (the script is not on disk but in RAM and being executed step by step. through stdin) and not available for user interaction or intervention in that child bash process.
the following three are the ones we should use...
1] . ./script.sh (. is source command. the one we use to set up environment. in profile or .bashrc etc)
2] bash ./script.sh
3] ./script.sh after using shebang and doing chmod
so the command using && as given by HR is one of the best oneliners.
therefore it becomes
wget --no-check-certificate https://raw.githubusercontent.com/hidden...r/bench.sh -O - -o /dev/null | bash -s -- -b
or use /dev/stdin if available in system.
but direct piping like that is bad from security standpoint. you dont get to see things. only do when you know what you are doing and know the script thoroughly.
also not all script will work through piping. cause stdin is engaged (the script is not on disk but in RAM and being executed step by step. through stdin) and not available for user interaction or intervention in that child bash process.
the following three are the ones we should use...
1] . ./script.sh (. is source command. the one we use to set up environment. in profile or .bashrc etc)
2] bash ./script.sh
3] ./script.sh after using shebang and doing chmod
so the command using && as given by HR is one of the best oneliners.
Sincere Thanks to VirMach for my VPS9. Also many thanks to Shadow Hosting and cubedata for the experiences I had with their VPSs.