Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This shell script dosent give me any output:

GID="gmod01"
PID= screen -list | grep $GID | cut -f1 -d'.' | sed 's/\W//g'
echo $PID

Echo PID is empty, how can i fix this? I get 12055 out but it dosent copy in the value

Thank you

share|improve this question

closed as not a real question by Tom O'Connor, Sven, EEAA, Ward, Dave M Apr 29 '13 at 13:46

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
Fix it yourself. –  Tom O'Connor Apr 29 '13 at 12:09
    
The very least you could do is to state what you want the command to actually do. –  Sven Apr 29 '13 at 12:16

1 Answer 1

up vote 0 down vote accepted

Use brackets.

GID="gmod01"
PID=$(screen -list | grep $GID | cut -f1 -d'.' | sed 's/\W//g')
echo $PID
share|improve this answer
    
Dosent works... /restart: line 2: syntax error near unexpected token |' ./restart: line 2: PID=(screen -list | grep $GID | cut -f1 -d'.' | sed 's/\W//g')' –  user2277716 Apr 29 '13 at 12:58
    
Will now, needs the bracket prefixed with a $ –  Sirch Apr 29 '13 at 13:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.