linux - creating bash script that runs for every subsequent command -
suppose created own bash script command called customcmd
i want if type in customcmd terminal, every subsequent commands following execute customcmd
so suppose
>customcmd >param1 >param2 >param3
i want equivalent of
>customcmd >customcmd param1 >customcmd param2 >customcmd param3
ie. want executing customcmd once, won't have type in customcmd again , want have command line parse every single command type afterwards automatically parameters customcmd...
how go achieving when writing bash script?
if understand question correctly, i'd following:
create script, eg mycommand.sh:
#!/bin/bash while [[ 1 ]]; read _input echo $_input done
- initialize infinite loop
- for each iteration, user input ( whatever ) , run through command specify in while loop ( if script needs parse multiple arguments, can swap our echo function can handle )
hope helps!
Comments
Post a Comment