0

In My shell script, I have following lines...

name=`grep -i "client" fin${i}.txt`
jobplan_name=`${name} | cut -d "=" -f4 | cut -d " " -f1`
echo ${jobplan_name}

Output:

<JOBP:  not found

Please correct me where the problem is

1 Answer 1

3

I think you need an echo:

jobplan_name=`echo ${name} | cut -d "=" -f4 | cut -d " " -f1`
Sign up to request clarification or add additional context in comments.

2 Comments

Without the echo, you are trying to execute a command named by name and piping its output to cut, rather than piping the value of name itself to cut.
Because the backticks say "give me the output of the command contained within". The contents of the name variable is not a command recognized by your system: Hence "not found". The output of the echo command is what you want: the string that the name variable contains.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.