Having trouble understanding this command: >foo<bar bc


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Having trouble understanding this command: >foo<bar bc
# 1  
Old 11-05-2010
Having trouble understanding this command: >foo<bar bc

Sometimes it works for me and sometimes I get this error:
syntax error on line 1, teletype
Basically I've got no idea whats going on, especially at the end of the command: bc

Any help is appreciated
# 2  
Old 11-05-2010
What it is, is just shell redirection, after the command instead of before.

Code:
# you can do it like this
cat <input >output
# or like this
<input >output cat

I think the 'syntax error' is actually an error inside bc, from an invalid command inside the 'bar' file.

bc is a calculator. Try echo 2 + 3 | bc Also see man bc

Last edited by Corona688; 11-05-2010 at 12:52 AM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. What is on Your Mind?

I'm having trouble understanding what it is I need to do

Ok, thank you. Again I'm new to the programming thing, I'm just trying to figure out what exactly it is I need to do. How would I cash out bits? Numerous questions. I'm a dreamer. AI attempts to communicate with me regularly especially through unfinished apps that I'm assuming is my responsibility... (1 Reply)
Discussion started by: C-lo
1 Replies

2. Shell Programming and Scripting

Trouble understanding shell scripting (mostly wsname)

Am still learning Scripting and I come across a build command that I don't really understand if /local/bin/wsname 2>/dev/null; then base="`/local/bin/wsname`" export base fi if ; then /local/bin/wsname exit 1 fi WSNAME="$base"/ can some one in light me to what... (1 Reply)
Discussion started by: Wpgn
1 Replies

3. Shell Programming and Scripting

ssh foo.com sudo command - Prompts for sudo password as visible text. Help?

I am writing a BASH script to update a webserver and then restart Apache. It looks basically like this: #!/bin/bash rsync /path/on/local/machine/ foo.com:path/on/remote/machine/ ssh foo.com sudo /etc/init.d/apache2 reloadrsync and ssh don't prompt for a password, because I have DSA encryption... (9 Replies)
Discussion started by: fluoborate
9 Replies

4. Homework & Coursework Questions

trouble understanding file option and command line arguments

Hi, I am creating a program with the C language that simulates the WC command in Unix. My program needs to count lines, bytes and words. I have not added the code to count bytes and words yet. I am having trouble understanding what the file option/flag '-' does. I can not visualize how it moves... (1 Reply)
Discussion started by: heywoodfloyd
1 Replies

5. UNIX for Dummies Questions & Answers

Odd result from cp -R foo/.* bar

I'm not all that much of a newbie but I've not encountered this before. Happens both in Cygwin and in Mac OS X (Darwin): cp -R /path/to/foo/.* /path/to/bar (where directory 'bar' exists) ... seems to copy not only the contents of directory 'foo', but also other directories that are... (3 Replies)
Discussion started by: ChapHarrison
3 Replies

6. Shell Programming and Scripting

SED: Extracting text between first occurance of foo in front of bar

Suppose I have a text file that contains the tags <foo> and <bar>. The text file can have unlimted occurances of <foo> and <bar> and looks somthing like this: <foo> Some Text <foo> Some Text <bar> Some Text <foo> Some (1 Reply)
Discussion started by: ArterialTool
1 Replies

7. Shell Programming and Scripting

Replace space and vertical bar with verical bar

I am trying to get sed, tr or awk to search a file that contains records with fields delimited by the vertical bar | and replace the occurrences in the records where the vertical bar is preceded by a space " |" with a vertical bar. Sample data record zelli |||59 Stonewall Dr ||W Barnstable |MA... (2 Replies)
Discussion started by: clintrpeterson
2 Replies

8. Shell Programming and Scripting

put a icon/command in menu bar

Hey everyone :)my problem is i want to add a command and icon to the menu panel, normally in gnome you would just right click, add to panel etc. What i want to do is, for example , put say firefox plus a icon in the menu bar by using a bash script, what would be the command, to do this. (5 Replies)
Discussion started by: dave123
5 Replies

9. UNIX for Dummies Questions & Answers

Little Trouble Understanding some code...

Couple of questions as I try to decipher someones code who left... What would something coded like this do? IFS=: grep FIELD1 /Path/Path2/Param.fle | read LBL1 LBL2 USRID EADR SUBJ SERVERNAME CFGTBL DIR ERR=0 Param.fle contents.. FIELD1:FEI::FIELD2:dATAFIELD BATCH:MAIN SERVER......etc.. (2 Replies)
Discussion started by: NycUnxer
2 Replies

10. Shell Programming and Scripting

Find directories not containing foo, and copy foo to them

Hello all, I have a situation where I have a web root directory with a few thousand users spread out into 100 subdirectories in a 00/firstname.lastname, 01/firstname.lastname, etc. hierarchy. I suddenly need to make sure that each of these user directories contains a default index.html file... (6 Replies)
Discussion started by: dkaplowitz
6 Replies
Login or Register to Ask a Question