02-03-2013
For my enlightenment - you use the linefeed just in case a string should contain a space. If that could be ruled out, a simple space as separator would do as well, wouldn't it?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
For my bash script, terminal with bash is generate an OK output and program works right.
already,
terminal with ash have "line 48: syntax error: Bad substitution" output and program don't work.
:confused: (0 Replies)
Discussion started by: s. murat
0 Replies
2. UNIX for Dummies Questions & Answers
Guys
I now have a script that's working in a BASH environment, however one line doesn't appear to be working on an embedded device that has a busybox therefore ASH shell. I've googled but there's very little I can find regarding the ASH shell.
In BASH the following line works...
if ] ;... (6 Replies)
Discussion started by: Bashingaway
6 Replies
3. Shell Programming and Scripting
Hi, I'm a beginner at shell scripting, just started scripting in bash a few days ago.
I want to test if the command ls *.jpg returns exit code 2, and if yes I want to execute a new command ls *.jpeg, doing a test on it... and pretty much repeat the procedure.
Is this correct?
#!/bin/bash... (1 Reply)
Discussion started by: Utherr
1 Replies
4. Shell Programming and Scripting
I have a script that has to execute a read command in a function, this is in an ash busybox.
The code is...
trapcatch () { echo "Ctl-c Detected, what do you want to do?"
echo "Please choose the number of one of the following options"
echo "1. Jump past this Set"
echo "2. Exit... (8 Replies)
Discussion started by: tesser
8 Replies
5. Ubuntu
I wrote Bash script and now I want to convert it to Ash. One headache is this function:
do_adduser() {
setaddprompt
_arr_add=("Add manually" "Add via TXT" "return to main menu" "exit program")
select add_action in "${_arr_add}"
do
case "$REPLY" in
1)... (7 Replies)
Discussion started by: fzivkovi
7 Replies
6. Ubuntu
I'm trying to convert this working bash script into an Ash script,
read -p "Username:" _username
if ! ]]; then
echo "Valid"
else
echo "INVALID"
fi
However, Ash does not recognize the "=~" character.
How can I do this?
Also, is there a good reference guide, so I... (5 Replies)
Discussion started by: fzivkovi
5 Replies
7. Ubuntu
hello everybody,
i'm a beginner in ash and i want to convert this bash script to ash.
this script send a xml file to a nagios server :
#!/bin/bash
PROGNAME=$(basename $0)
RELEASE="Revision 0.3"
print_release() {
echo "$RELEASE"
}
print_usage() {
echo ""
echo "$PROGNAME... (6 Replies)
Discussion started by: mdijoux25
6 Replies
8. Shell Programming and Scripting
Hi everyone,
i have the following script.sh:
foo='lsusb | grep Webcam | cut -c16-18'
sudo /home/user/public/usbreset /dev/bus/usb/001/$foo
when i try to call this script from python using subprocess.call("script.sh", shell=True) it seems that only 'sudo /home/user/public/usbreset' is being... (6 Replies)
Discussion started by: hilfemir
6 Replies
9. UNIX for Beginners Questions & Answers
Hi everyone, first time visitor to these forums here.
Keeping a long story short I've been attempting to learn how to code in bash. I have VERY little previous experience with coding languages besides simply copying and pasting batch scripts for Windows. So, with that in mind I've followed a... (4 Replies)
Discussion started by: Meta
4 Replies
10. UNIX for Beginners Questions & Answers
Hello so I've stored some csv data to be read into variables like this
Name,Team,Shop,Shoe
etc,etc,etc,etc
Code:
sep=","
{
while IFS=$sep read Name Team Shop Shoe
do
count=1
dirname=$Name
while
do
((count++))
dirname="${Name}$count" (4 Replies)
Discussion started by: darklord173
4 Replies
LEARN ABOUT HPUX
smfi_insheader
smfi_insheader(3N) smfi_insheader(3N)
NAME
smfi_insheader() - prepends a header to the current sendmail message
SYNOPSIS
PARAMETERS
ctx Specifies the opaque context structure.
hdridx Specifies the location in the internal header list where the header must be inserted. A value of 0 (zero) places the header in
the beginning of the header.
headerf Specifies the header name, which is a non-NULL, null-terminated string.
headerv Specifies the header value to be added. A header value is a non-NULL, null-terminated string and can be an empty string.
DESCRIPTION
prepends a header to the current message. can be called only from the function.
Notes
o does not change existing headers of a message. To change the current value of a header, use the routine.
o A filter that calls must set the flag in the structure passed to the routine.
o For the filter, the order in which filters are placed is imporant. Filters placed later in the sequence will observe the changes
already done by the earlier filters.
o If the value of hdridx larger than the number of headers in the message, the header is simply be appended.
o The name and the value of the header are not checked for standards compliance. However, each line of the header must be under 2048
characters. If longer headers are needed, multi-line header must be used. To make a multi-line header, insert a linefeed (ASCII 0x0a,
or
in C) followed by at least one whitespace character, such as, a space (ASCII 0x20) or tab (ASCII 0x09, or in C). The linefeed
must not be preceded by a carriage return (ASCII 0x0d); the MTA adds this automatically. It is the responsibility of the filter writer
to ensure that standards are not violated.
RETURN VALUE
returns due to the following reasons:
o The headerf or headerv value is NULL.
o Adding headers in the current connection state is invalid.
o Memory allocation fails.
o Network error occurs.
o is not set when is called.
returns on success.
EXAMPLES
AUTHOR
was developed by the Sendmail Inc.
SEE ALSO
smfi_chgheader(3N), smfi_addheader(3N), smfi_addrcpt(3N), smfi_delrcpt(3N), smfi_replacebody(3N).
on
smfi_insheader(3N)