当前位置:网站首页>Assign the output of a command to a variable [repeat] - assigning the output of a command to a variable [duplicate]
Assign the output of a command to a variable [repeat] - assigning the output of a command to a variable [duplicate]
2022-07-05 22:17:00 【Technology feast】
problem :
I am new with unix and I am writing a shell script. I am a unix Novice , Writing a shell Script .
When I run this line on the command prompt, it prints the total count of the number of processes which matches: When I run this line at the command prompt , It will print the total number of matching processes :
ps -ef | awk '/siebsvc –s siebsrvr/ && !/awk/ { a++ } END { print a }'example, the output of the above line is 2 in the command prompt. for example , The output of the above line at the command prompt is 2.
I want to write a shell script in which the output of the above line (2) is assigned to a variable, which will be later be used for comparison in an if statement. I want to write one shell Script , Among them, paragraph (2) The output of the row is assigned to a variable , This variable will be used later in if Statement .
I am looking for something like I'm looking for something similar
output= `ps -ef | awk '/siebsvc –s siebsrvr/ && !/awk/ { a++ } END { print a }'`echo $outputBut when i run it, it says output could not be found whereas I am expecting 2. Please help. But when I run it , It says the output cannot be found , And I expect 2. Please help .
Solution :
Reference resources : https://stackoom.com/en/question/1Oo2K边栏推荐
- Leetcode simple question check whether all characters appear the same number of times
- Overview of database recovery
- Kubernetes Administrator certification (CKA) exam notes (IV)
- Implementation technology of recovery
- Comment développer un plug - in d'applet
- Oracle triggers
- Search: Future Vision (moving sword)
- The real situation of programmers
- Leetcode simple question: find the nearest point with the same X or Y coordinate
- How can Bluetooth in notebook computer be used to connect headphones
猜你喜欢

Implementation technology of recovery

Matlab draws a cute fat doll

Database tuning solution

数博会精彩回顾 | 彰显科研实力,中创算力荣获数字化影响力企业奖

极狐公司官方澄清声明

Summary of concurrency control

笔记本电脑蓝牙怎么用来连接耳机

如何快速体验OneOS

What if the files on the USB flash disk cannot be deleted? Win11 unable to delete U disk file solution tutorial

AD637使用笔记
随机推荐
Technology cloud report: how many hurdles does the computing power network need to cross?
Sentinel production environment practice (I)
Common interview questions of redis factory
What if win11 is missing a DLL file? Win11 system cannot find DLL file repair method
Overriding equals() & hashCode() in sub classes … considering super fields
Web3为互联网带来了哪些改变?
Database recovery strategy
如何开发引入小程序插件
854. String BFS with similarity K
Pl/sql basic case
Matlab draws a cute fat doll
Oracle triggers
The American Championship is about to start. Are you ready?
数博会精彩回顾 | 彰显科研实力,中创算力荣获数字化影响力企业奖
Leetcode simple question check whether all characters appear the same number of times
A substring with a length of three and different characters in the leetcode simple question
CA certificate trampled pit
笔记本电脑蓝牙怎么用来连接耳机
Platform bus
344. Reverse String. Sol