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
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
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
Check the essays out.
http://www.paulgraham.com (0 Replies)
Discussion started by: photon
0 Replies
4. What is on Your Mind?
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?
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
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
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
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?
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?
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
LEARN ABOUT DEBIAN
string::shellquote
ShellQuote(3pm) User Contributed Perl Documentation ShellQuote(3pm)
NAME
String::ShellQuote - quote strings for passing through the shell
SYNOPSIS
$string = shell_quote @list;
$string = shell_quote_best_effort @list;
$string = shell_comment_quote $string;
DESCRIPTION
This module contains some functions which are useful for quoting strings which are going to pass through the shell or a shell-like object.
shell_quote [string]...
shell_quote quotes strings so they can be passed through the shell. Each string is quoted so that the shell will pass it along as a
single argument and without further interpretation. If no strings are given an empty string is returned.
If any string can't be safely quoted shell_quote will croak.
shell_quote_best_effort [string]...
This is like shell_quote, excpet if the string can't be safely quoted it does the best it can and returns the result, instead of dying.
shell_comment_quote [string]
shell_comment_quote quotes the string so that it can safely be included in a shell-style comment (the current algorithm is that a sharp
character is placed after any newlines in the string).
This routine might be changed to accept multiple string arguments in the future. I haven't done this yet because I'm not sure if the
strings should be joined with blanks ($") or nothing ($,). Cast your vote today! Be sure to justify your answer.
EXAMPLES
$cmd = 'fuser 2>/dev/null ' . shell_quote @files;
@pids = split ' ', `$cmd`;
print CFG "# Configured by: ",
shell_comment_quote($ENV{LOGNAME}), "
";
BUGS
Only Bourne shell quoting is supported. I'd like to add other shells (particularly cmd.exe), but I'm not familiar with them. It would be
a big help if somebody supplied the details.
AUTHOR
Roderick Schertler <roderick@argon.org>
SEE ALSO
perl(1).
perl v5.8.4 2005-05-03 ShellQuote(3pm)