ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I would really like to be able to do something similar in a Bourne shell script where I don't have to manage a collateral text file which is prone to getting lost. Does anyone know if there is a similar construct in shell programming? I would have thought this feature was a remnant that Perl inherited from its shell programming roots, but searching on the Web has revealed nothing of consequence.
AFAIK no such facility exists. While it could be programmed there would be a fundamental problem in that it is not possible for bash scripts to reliably find the file they are run from as explained here.
AFAIK no such facility exists. While it could be programmed there would be a fundamental problem in that it is not possible for bash scripts to reliably find the file they are run from as explained here.
Thanks. I am aware of "here" documents. I was hoping that someone would know the history or lineage where __DATA__ came from (thinking it came from shell programming...), but just as searching didn't reveal anything, it must have started with Perl.
Thanks. I am aware of "here" documents. I was hoping that someone would know the history or lineage where __DATA__ came from (thinking it came from shell programming...), but just as searching didn't reveal anything, it must have started with Perl.
Larry Wall is just one righteous dude.
Thanks everyone for your answers.
As far as the origin, it goes back much before perl. Mainframe systems, using punched card readers use a process control language (early scripting) called JCL (job control language). Card decks were 'stacked' in the reader: JCL, source, more JCL, data. For example:
As far as the origin, it goes back much before perl. Mainframe systems, using punched card readers use a process control language (early scripting) called JCL (job control language).
Oooo! It made me come over all nostalgic I remember when ...
JCL is where the dd command came from, both in name and its unconventional (for UNIX) syntax. IIRC DD meant "data definition" ... ?
In FORTRAN shops, for example, you could save compute time (and therefore money in your research budget) by compiling your program and sending the object deck to the card punch. Then you could run your program over and over with different sets of data (in those days, a file was known as a "data set"). You'd put the punched object deck near the beginning of your batch job preceded by this:
Code:
//LINK.SYSIN DD *
and followed by the all-purpose end of file indicator:
Code:
/*
That end of file indicator could have anything you wanted in columns 3 through 80, so it was customary (at least at UC Irvine) to have lots of cards available which, for the sake of convenience, looked like this:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.