Sponsored Content
Top Forums Shell Programming and Scripting Shell quoting rules for other languages programmers Post 302717797 by DGPickett on Thursday 18th of October 2012 03:01:42 PM
Old 10-18-2012
Well, avoiding injection attacks and massive mistakes, with or without eval, often revolves around using quotes corrrectly and expecting all sorts of poorly behaved input data.

Rather than storing data in multiple variables with intelligence in the name, use the array. I read that in bash, simple arrays are actually implemented in a linked list, so adjust your performance expectation for big sets downward accordingly. If numeric keys and simple arrays are inconvenient, use the array-like hash container types that take string keys, in bash called associtive arrays. Hash (random) access scales much better. You have to go to PERL and up to get real arrays, other sorts of linked lists and trees as well as hash mapped containters.
 

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Shell scripting & programming languages

If I want to do high-end 3d animation, what skell scripting languages, and programming languages shoul I learn? If you know any good resources for learning these languages they would be appreciated. (1 Reply)
Discussion started by: aloysius1001
1 Replies

2. UNIX for Advanced & Expert Users

Perl - Programmers manual online?

I have never programmed in Perl (insert laughter, mock, etc. here ____) - so I need a sort of "Programming in Perl" covering the basics. I now have two Perl books, one is a 5 volume Unix resource kit, the other is "Mastering algorithms with Perl" - none of them explains how to produce "hello,... (11 Replies)
Discussion started by: AtleRamsli
11 Replies

3. News, Links, Events and Announcements

Good Essays For Programmers

Check the essays out. http://www.paulgraham.com (0 Replies)
Discussion started by: photon
0 Replies

4. What is on Your Mind?

Suggested venues to look for advanced C programmers

Can someone suggest any online venues to assist in recruiting a senior C programmer (looking for someone interested in working on kerberos code). I've tried a bunch of the open source and higher ed lists (this is for Univ. of Michigan). The commercial services such as Dice or monster yield a... (7 Replies)
Discussion started by: painman
7 Replies

5. What is on Your Mind?

Programming languages polyglots: how many languages you know?

Post what languages (including scripting) you know, why and where you think that language is most usable. Also include libraries in which you're really good at (libusb, gtk, qt, etc). assembly? C or C++? perl or python? pascal? bash or csh/tcsh? opengl? gtk or qt? mono? (27 Replies)
Discussion started by: redoubtable
27 Replies

6. Shell Programming and Scripting

Shell quoting problem while editing a remote file using sed

value of i = solarisbox ssh $i "cat /etc/hosts | sed "s/$i\.local\.//" | sed "s/$i\./$i/" | sed "s/$i/$i.sol.com/" > /usr/users/chidori/edit_hosts"While running the above one liner its i am not able to make the changes and write it to the file /usr/users/chidori/edit_hosts . I know there is a... (2 Replies)
Discussion started by: chidori
2 Replies

7. Programming

Hello UNIX programmers

i have MOTIF installed X11 a easy program is saved as hello.c there is the following message where can i get the X11/intrinsic.h , file ??? need help to compile my system : MX-16 Linux Debian Jessie / i386 hans@mx1:~/Documents $ cc push.c -o push -lXm -lXt -lX11 In file included from... (0 Replies)
Discussion started by: Zabo
0 Replies

8. Forum Support Area for Unregistered Users & Account Problems

Trojan is detected when I visit Programmers forum

When I visit Programmers forum my ESET Nod32 detects TrojanDownloader.Pegel.BH.trojan I don't know when it started, as I visited the site today after staying off-line a few days. (2 Replies)
Discussion started by: migurus
2 Replies

9. What is on Your Mind?

Multics Systems Programmers Manual as of 1969-04-01, comprising 996 PDF Files

While working on my current "UNIX history project" I ran across this: Jerry Saltzer created an online scanned copy of the Multics Systems Programmers' Manual (MSPM) in this directory. Based on the 1969-04-01 MSPM, the repo comprising 996 PDF files. In order to help preserver the MSPM, ... (1 Reply)
Discussion started by: Neo
1 Replies

10. What is on Your Mind?

The poorest of computer users are programmers...

Hi guys and gals... A mildly humourous blog from 2013, but I come into this category... ;oDD Languager: The Poorest Computer Users are Programmers (0 Replies)
Discussion started by: wisecracker
0 Replies
mbox(5) 							File Formats Manual							   mbox(5)

NAME
mbox - file containing mail messages INTRODUCTION
The most common format for storage of mail messages is mbox format. An mbox is a single file containing zero or more mail messages. MESSAGE FORMAT
A message encoded in mbox format begins with a From_ line, continues with a series of non-From_ lines, and ends with a blank line. A From_ line means any line that begins with the characters F, r, o, m, space: From god@heaven.af.mil Sat Jan 3 01:05:34 1996 Return-Path: <god@heaven.af.mil> Delivered-To: djb@silverton.berkeley.edu Date: 3 Jan 1996 01:05:34 -0000 From: God <god@heaven.af.mil> To: djb@silverton.berkeley.edu (D. J. Bernstein) How's that mail system project coming along? The final line is a completely blank line (no spaces or tabs). Notice that blank lines may also appear elsewhere in the message. The From_ line always looks like From envsender date moreinfo. envsender is one word, without spaces or tabs; it is usually the envelope sender of the message. date is the delivery date of the message. It always contains exactly 24 characters in asctime format. moreinfo is optional; it may contain arbitrary information. Between the From_ line and the blank line is a message in RFC 822 format, as described in qmail-header(5), subject to >From quoting as described below. HOW A MESSAGE IS DELIVERED
Here is how a program appends a message to an mbox file. It first creates a From_ line given the message's envelope sender and the current date. If the envelope sender is empty (i.e., if this is a bounce message), the program uses MAILER-DAEMON instead. If the envelope sender contains spaces, tabs, or newlines, the program replaces them with hyphens. The program then copies the message, applying >From quoting to each line. >From quoting ensures that the resulting lines are not From_ lines: the program prepends a > to any From_ line, >From_ line, >>From_ line, >>>From_ line, etc. Finally the program appends a blank line to the message. If the last line of the message was a partial line, it writes two newlines; oth- erwise it writes one. HOW A MESSAGE IS READ
A reader scans through an mbox file looking for From_ lines. Any From_ line marks the beginning of a message. The reader should not attempt to take advantage of the fact that every From_ line (past the beginning of the file) is preceded by a blank line. Once the reader finds a message, it extracts a (possibly corrupted) envelope sender and delivery date out of the From_ line. It then reads until the next From_ line or end of file, whichever comes first. It strips off the final blank line and deletes the quoting of >From_ lines and >>From_ lines and so on. The result is an RFC 822 message. COMMON MBOX VARIANTS
There are many variants of mbox format. The variant described above is mboxrd format, popularized by Rahul Dhesi in June 1995. The original mboxo format quotes only From_ lines, not >From_ lines. As a result it is impossible to tell whether From: djb@silverton.berkeley.edu (D. J. Bernstein) To: god@heaven.af.mil >From now through August I'll be doing beta testing. Thanks for your interest. was quoted in the original message. An mboxrd reader will always strip off the quoting. mboxcl format is like mboxo format, but includes a Content-Length field with the number of bytes in the message. mboxcl2 format is like mboxcl but has no >From quoting. These formats are used by SVR4 mailers. mboxcl2 cannot be read safely by mboxrd readers. UNSPECIFIED DETAILS
There are many locking mechanisms for mbox files. qmail-local always uses flock on systems that have it, otherwise lockf. The delivery date in a From_ line does not specify a time zone. qmail-local always creates the delivery date in GMT so that mbox files can be safely transported from one time zone to another. If the mtime on a nonempty mbox file is greater than the atime, the file has new mail. If the mtime is smaller than the atime, the new mail has been read. If the atime equals the mtime, there is no way to tell whether the file has new mail, since qmail-local takes much less than a second to run. One solution is for a mail reader to artificially set the atime to the mtime plus 1. Then the file has new mail if and only if the atime is less than or equal to the mtime. Some mail readers place Status fields in each message to indicate which messages have been read. SEE ALSO
maildir(5), qmail-header(5), qmail-local(8) mbox(5)
All times are GMT -4. The time now is 01:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy