linux - How to cut a particular piece of data and store it in a String in Shell Script -


i new @ linux , having problems getting piece of data string. tried is

str = $(openssh version) | cut -d" " -f2 

this did line not showing error string containing null. when running in console getting required output

echo $(openssh version) | cut -d" " -f2 

this gives output 1.0.0c(openssl version number)this require when run in shell script want compare other string.

did made mistake in syntax or if there other way it. should run both in linux , aix system.

you need put "cut" command inside parens, , eliminate whitespace around "=":

str=$(openssh version | cut -d" " -f2) 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -