Tab Indented Standard Input Redirect in Bash

I managed to forget how to redirect standard input (when you want to feed a bunch of lines to a program) in a bash script while still indenting and had to go digging around for it. So I figured I’d make a note here so I don’t forget again and for anyone else in the same boat. It’s just <<- instead of <<. For example if you want to keep indentation within a loop:

for i in 1 2 3 4;do cat<<-EOF This is loop $i More advanced stuff could go here EOF done [/bash]

You can use whatever you want to indicate the end of the input instead of EOF if it floats your boat (as long as you use the same thing both times) but unfortunately <<- doesn’t work with spaces for indentation (although I’m a tab man myself).


Comments (2)


RCN Not Perfect – 404 Redirects

Redirected 404 Page Thanks to RCN

Well I wondered how long it would take before I hit a snag with RCN’s internet service after praising it. It turns out it only took a few days before I found out they redirect 404’s (incorrect addresses or webpages that are temporarily down) to their (spammy-looking) “help” page. Now perhaps I’m too picky but I’m quite happy with the way my browser handles things now and if I wanted something different I sure wouldn’t pick crappy search results mixed with ads for my solution. I suppose I could live with the useless page but it also rewrites the address so if I type I have retype the whole thing instead of just adding an ‘a’ to exmple (really a pain when developing websites). And mostly it just annoys me to suddenly be on a page that sets off my spam detectors. So I set out to figure out how to fix it.

On the bottom of the RCN page, there is an option to opt out but it actually then sends you to a buggy Internet Explorer error screen (and still rewrites your address). Since there’s no opt out that left working around them. RCN is inserting their page through their DNS servers so using a different server should fix the problem. I had been meaning to try out OpenDNS anyway so I figured I might as well make some lemonade out of lemons. But it turns out OpenDNS do the same redirection thing to their own page. So it was back to a google that turned up this helpful page of alternate DNS servers. I’m a little leary of using unknown servers (since you send them the address for every site you visit and they can send you wherever they want) but the servers through are all from Level 3 Communications Inc which seem pretty widely used and reputable. OpenDNS provides a handy guide to changing your DNS servers (if you don’t want to use theirs you can substitute any other IP address) for anyone with similar problems.


Comments (0)