Thread: How to do Complex Variables
hey guys,
im novice scripting gental.
okay script:
now input giving me issues when runs line $process doesnt picked up. can suggest better way of doing this?#!/bin/bash
echo "what process need?"
read process
input="ps aux |grep $process | grep -v grep | awk '{print $2}'"
kill $input
kind regards,
fenlig
you need use command substitution. in script $input string inside double quotes. instead of
you needcode:input="ps aux |grep $process | grep -v grep | awk '{print $2}'"
see here http://mywiki.wooledge.org/bashguide/specialcharacterscode:input=$(ps aux |grep $process | grep -v grep | awk '{print $2}')
quote variables , use lower case variables.
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [SOLVED] How to do Complex Variables
Ubuntu
Comments
Post a Comment