linux - use text and use as command? -
i whant build script extract word file in command:
for example: in file keep username , how can export username without knowing username part of command , command : suspend here should word exported?
from file has text inside "john" how can tell command : suspend username john ?
how can cat/grep/sed text file part of command :
something suspend |cat file , have try suspend command not take username , there should different .
my ideea this
#!/bin/sh username=cat my-file; suspend $username ,
but had no succes , because $username not display cat , cat shows thats doing.
use following syntax
username=$(cat my-file)
you might use backquotes like
username=`cat my-file`
but $(
...)
notation preferable: can nested , more readable.
please read advanced bash scripting guide (it teach lot, if can criticized)
your usage of suspend
incorrect, , don't understand want it. suspending user mean you? perhaps want use pgrep or pkill
(to kill processes of user, feel harsh)...?
Comments
Post a Comment