• 0

confused on unix special character command


Question

Write a script that outputs your name. So if your name is "Joe Smith". The script should echo "Joe Smith" to the screen.

the answer is $cat tut2q1.sh

!/bin/bash

This is a script to print Joe Smiths name.

echo 'Joe Smith' $

but after i write $cat blah blah, the next command line gives me > symbol. after finish typing until the end of $, i can't get out of the sh? how do you type those command step by step?

thanks

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

You have noend explained this very well

Remive the end $

And u need a # at the start of the bin bash line

Link to comment
Share on other sites

  • 0

For your script to print the name, your bash script should be simply:

#!/bin/bash

echo 'Joe Smith'

However alternatively you can use the command whoami which will return the user's name: i.e.

#!/bin/bash

whoami

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.