linux - Bash command substitution with extra whitespace: How to solve this? -


I would like to change the number of processes to know my command line:

 > ; Cat / proc / "fuser / dev / ttyS0`" / cmdline cat: / proc / 5231 / cmdline: Any such file or directory   

but it seems that fuser < / Code> Adds an extra white space in PID

Expected behavior: I want to get a process ID using the Fusor and in the second stage of the display / Proc / & lt; ID & gt; / Cmdline .

I think the echo \ "` fuser / dev / ttyS0` \ " will show you that there is a prominent place if you split your operation in two steps, then you can do the following

  u = `fuser / dev / ttyS0` cat / proc / $ {U /}} / cmdline   

Then first you put the result of fusor on the variable u (which is still the location ), And then you start a paradigm shift with all the codes with U ( // if you Evl / , then the place of all events, will simply replace the first event - which will not have any problem in your example).

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -