-7
a=Hello-World
b=$(a|cut -d- -f1)
echo "$b"

The above commands are not working for me. Any input?

  • https://unix.stackexchange.com/help/how-to-ask and https://www.gnu.org/software/bash/manual/html_node/Command-Substitution.html – ilkkachu Nov 14 '17 at 08:59
  • 3
    "Not working", what do you mean by that terribly tough support question? I.e. what do you expect to happen, and which doesn't seem to be the case? After you edit your question to clarify that, I'll consider removing my downvote – Pierre.Vriens Nov 14 '17 at 09:01
  • 2
    Please explain what you mean by not working. Add any error messages to the question. – ctrl-alt-delor Nov 14 '17 at 10:08

1 Answers1

-3
a=Hello-World
b=$(echo $a|cut -d- -f1)
echo "$b"

Why do people always ask such very easy questions? RTFM can resolve most of these questions. Learn by yourself first please.

Bruce
  • 1,241