4

i have tried for like 30 minutes. Whats wrong with this code ? :( Input :

var = `cat marktplatz.html | grep -m 1 "post" | grep -o -E '\b(jobs/.*htm)' `

Output :

var: command not found
2
  • 2
    Apart from the spacing issue, this is a useless use of cat. It can be written more succinctly as grep -m 1 "post" < marktplatz.html | grep -o -E '\b(jobs/.*htm)' -- or even as < marktplatz.html grep -m 1 "post" | grep -o -E '\b(jobs/.*htm)' Commented Sep 5, 2011 at 21:54
  • 1
    Thanks Keith, .. i am new to bash and programming. Good to know, that this code can be optimized. Always willing to learn from the experienced guys ;) Commented Sep 6, 2011 at 0:03

1 Answer 1

5
var = BLABLA

should be

var=BLABLA

The first form is interpreted as running the command var with = as the first argument.

Sign up to request clarification or add additional context in comments.

Comments

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.