2016-03-22 16 views
-1

Ben sedÇıkarma alt dize

girişimim kullanarak sunucuda nginx sürümünü almaya çalışıyorum

nginx -v | sed -e "s|nginx version: nginx/||" 

Çıktı

nginx version: nginx/1.9.12 

Beklenen çıkış

1.9.12 

cevap

0

nginx baskılar versiyon stderr, bu nedenle çıktı yönlendirmek gerekir:

nginx -v 2>&1 | sed -e "s|nginx version: nginx/||" 
#  ^redirect stderr to stdout 
-1

nginx -v`and `nginx` arasında bir fark vardır çıkışı

 
nginx version: nginx/1.2.3 
built by gcc 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) 
TLS SNI support enabled 
configure arguments: --without-http_autoindex_module --without-http_userid_module --without-http_auth_basic_module --without-http_fastcgi_module --without-http_empty_gif_module --with-poll_module --with-http_stub_status_module --with-http_ssl_module --with-ipv6 --with-http_geoip_module 
+0

Samplesini edin -V' – user2650277