HannahI 0 Report post Posted October 29, 2009 Let's share UNIX commands. To start off, here are some. function - create a function - Syntax: function myfunction() {echo - print - syntax: echo hello-Hannah Share this post Link to post Share on other sites
wutske 0 Report post Posted October 31, 2009 You're talking about writing a BASH script, right ? Because "UNIX commands" is a very vague description which I interpret as commands to start an application (eg "ping 127.0.0.1"). Share this post Link to post Share on other sites
yordan 10 Report post Posted October 31, 2009 function - create a function - Syntax: function myfunction() {and also, please, when you give such an info, give it completely.I'm pretty sure the heading "{" needs a trailing "}" in order the function description to be complete. Share this post Link to post Share on other sites
wutske 0 Report post Posted October 31, 2009 and also, please, when you give such an info, give it completely.I'm pretty sure the heading "{" needs a trailing "}" in order the function description to be complete. Now that we're talking about mistakes. Usualy a string is places between " " , unless hello is a previously defined variable.So it should probably beecho "hello"orstring hello = "Hello there";echo hello; But it all depends on which language/environment you're using Share this post Link to post Share on other sites
BCD 1 Report post Posted November 1, 2009 In Unix I have observed the following two statements give the same results: CONSOLE echo $SHELL CONSOLE echo "$SHELL"Both the methods will process the variable and prints which shell is running.To take the input as text, whether or not there are variables included, it would be included in single quotesCONSOLE echo '$SHELL'The output would be $SHELLHere are some more commands which are commonly used:tput clear# Clears screenls -l > list#Saves the list of files and directories in the current directory with attributes (-l) in "list" file.cat filename# Display file contentswc list# Counts number of lines. x lines, x words, x charactersAnything starting with hypen (-) is an option. It needs to be separate, that is no characters after or before it. Share this post Link to post Share on other sites
yordan 10 Report post Posted November 1, 2009 tput clear# Clears screenTalking about tput, another interesting one istput sgr0This resets your terminal to standard values, removing "rev", "blink" and other disagreeable features you got if you "cat" a binary file to your display. Share this post Link to post Share on other sites
HannahI 0 Report post Posted November 1, 2009 Yes, Yes, Yes and Yes.Now I'm actully learning something! Share this post Link to post Share on other sites