Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 17 Aug 2018, 07:09
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Open terminal killer
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 2 [16 Posts]   Goto page: Previous 1, 2
Author Message
jpeps

Joined: 31 May 2008
Posts: 3217

PostPosted: Wed 30 Nov 2011, 02:36    Post subject:  

Shep wrote:
jpeps wrote:
Code:

pid=$(pidof rxvt) && kill -9 $pid


interesting note: "$pid" won't work


It will work if there is only one rxvt process. Otherwise, you're instructing it to interpret your list of PIDs as a single long PID containing embedded spaces (i.e., quite invalid).


I guess it's more interesting that it works without quotes, since it's not really an array. ${x[0]} is the whole list either way. Yet you can perform separate actions on elements if unquoted.

Code:

pid=$(pidof rxvt)

for x in "$pid"; do
echo "ID ${x}"
done

for x in $pid; do
echo "ID ${x}"
done
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 2 [16 Posts]   Goto page: Previous 1, 2
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0464s ][ Queries: 12 (0.0120s) ][ GZIP on ]