Sponsored Content
Top Forums Shell Programming and Scripting Getting email output in single line with out space in email Post 302978747 by jim mcnamara on Wednesday 3rd of August 2016 07:52:12 AM
Old 08-03-2016
Next problem:
Consider enclosing "$MESSAGE_0" in double quotes in your echo statement. Do this for most of your echo statements as well.

Why? What happens if one of the words in the message is a UNIX command or a comment -- # character or > character?
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win)

Hi A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : FName.Surname@Citigroup.com ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as " usr1@unix-host1.unregistered.email.citicorp.com " .i.e the words... (2 Replies)
Discussion started by: Vetrivela
2 Replies

2. Shell Programming and Scripting

Coverting Firstname <Space> Lastname into email id

I have a file like below : bash-2.03$ cat neweamil2 Nigueel Rafferty Thomas333 Middletonsss Shwaita33 Ambasss Zhi21 Caiss Saluweh Husain Nigueel Rafferty Saleuikh Husainse Desiyshskan Santhio Need to convert firstname <space> lastname into email id . For eg. (1st... (4 Replies)
Discussion started by: sriram003
4 Replies

3. Shell Programming and Scripting

Stripping out more than a space from a line, but keep single space.

Hi all, Is there a way to perform the above, I am trying to strip out more than one space from a line, but keep the single space. See below output example. My Name is test test2 test3 test4 test5 My Name is test test2 test3 test4 test5 Please note that the lines would contain... (7 Replies)
Discussion started by: eo29
7 Replies

4. UNIX for Dummies Questions & Answers

new to ldap, send email to a ou or group, and see a list from email client

hi, i'm running openldap on ubuntu 10.04, creating new items with apache directory studio (windows version). i use the ldap just as an address book to our small office (email clients are windows live mail 2009, 2011, microsoft outlook 2007 and 2010). a. i cant see a list of the contacts,... (0 Replies)
Discussion started by: V4705
0 Replies

5. Shell Programming and Scripting

Check and compare disk space and email it

I am very new to Linux and learning to script. This is for one of my servers at work that I have to keep track off as far as disk space and how it is used. I have tried to go line by line but little things keep chewing me up. I would appreciate any and all help or advice, and Mutt is installed on... (3 Replies)
Discussion started by: sgtjkj
3 Replies

6. Shell Programming and Scripting

Using top command to email if process is exceeding 25% and sending an email alert if so

This is my first time writing a script and Im having some trouble, Im trying to use the top command to monitor processes and the amount of CPU usage they require, my aim is to get an email if a process takes over a certain percentage of CPU usage I tried grep Obviosly that hasnt worked, Any... (8 Replies)
Discussion started by: jay02
8 Replies

7. Shell Programming and Scripting

Sending an email if system disk space is low

Hello i have a working script that sends me an email if system disk space is above 98%. I would like to add an extra command to the if condition. If disk space is above 98% it would also add an output of cd /var/log && du -sBM * |sort -n 2>&1 |grep -v -e "0M" -e "1M" command to the email. I'm... (2 Replies)
Discussion started by: taf130
2 Replies

8. Shell Programming and Scripting

Send Disk Space Usage Status via email

Hi Guys, Is there any way I can write a script that sends DISK SPACE USAGE STATUS via email once a week? Thanks, (5 Replies)
Discussion started by: g4v1n
5 Replies

9. Shell Programming and Scripting

Generate disk space usage email alert

hi all members I have a shell script to generate disk space usage email alert if threshold is more than 80 %, now the requirement changed to keep sending alert emails for every 5% incremental usage ........ Any help would be greatly appreciated. ex - 80% , 85% ,90%,95%,100% we should get an... (6 Replies)
Discussion started by: anil529
6 Replies

10. Shell Programming and Scripting

Sending sql output to email body with conditional subject line

hi , i have written below piece of code to meet the requirement but i am stuck in the logic here. the requirement are: 1) to send the sql out put to email body with proper formatting. 2) if count_matching = Yes then mail should triggered with the subject line ... (10 Replies)
Discussion started by: itzkashi
10 Replies
echo(1) 							   User Commands							   echo(1)

NAME
echo - echo arguments SYNOPSIS
/usr/bin/echo [string...] DESCRIPTION
The echo utility writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output. If there are no arguments, only the NEWLINE character will be written. echo is useful for producing diagnostics in command files, for sending known data into a pipe, and for displaying the contents of environ- ment variables. The C shell, the Korn shell, and the Bourne shell all have echo built-in commands, which, by default, will be invoked if the user calls echo without a full pathname. See shell_builtins(1). sh's echo, ksh's echo, and /usr/bin/echo understand the back-slashed escape charac- ters, except that sh's echo does not understand a as the alert character. In addition, ksh's echo, does not have an -n option. sh's echo and /usr/bin/echo only have an -n option if the SYSV3 environment variable is set (see ENVIRONMENT VARIABLES below). If it is, none of the backslashed characters mentioned above are available. csh's echo and /usr/ucb/echo, on the other hand, have an -n option, but do not under- stand the back-slashed escape characters. OPERANDS
The following operand is supported: string A string to be written to standard output. If any operand is "-n", it will be treated as a string, not an option. The following character sequences will be recognized within any of the arguments: a Alert character.  Backspace. c Print line without new-line. All characters following the c in the argument are ignored. f Form-feed. New-line. Carriage return. Tab. v Vertical tab. \ Backslash. n Where n is the 8-bit character whose ASCII code is the 1-, 2- or 3-digit octal number representing that character. USAGE
Portable applications should not use -n (as the first argument) or escape sequences. The printf(1) utility can be used portably to emulate any of the traditional behaviors of the echo utility as follows: o The Solaris 2.6 operating environment or compatible version's /usr/bin/echo is equivalent to: printf "%b " "$*" o The /usr/ucb/echo is equivalent to: if [ "X$1" = "X-n" ] then shift printf "%s" "$*" else printf "%s " "$*" fi New applications are encouraged to use printf instead of echo. EXAMPLES
Example 1: Finding how far below root your current directory is located You can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows: o Echo your current-working-directory's full pathname. o Pipe the output through tr to translate the path's embedded slash-characters into space-characters. o Pipe that output through wc -w for a count of the names in your path. example% /usr/bin/echo $PWD | tr '/' ' ' | wc -w See tr(1) and wc(1) for their functionality. Below are the different flavors for echoing a string without a NEWLINE: Example 2: /usr/bin/echo example% /usr/bin/echo "$USER's current directory is $PWDc" Example 3: sh/ksh shells example$ echo "$USER's current directory is $PWDc" Example 4: csh shell example% echo -n "$USER's current directory is $PWD" Example 5: /usr/ucb/echo example% /usr/ucb/echo -n "$USER's current directory is $PWD" ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of echo: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, and NLSPATH. SYSV3 This environment variable is used to provide compatibility with INTERACTIVE UNIX System and SCO UNIX installation scripts. It is intended for compatibility only and should not be used in new scripts. EXIT STATUS
The following error values are returned: 0 Successful completion. >0 An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |enabled | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
echo(1B), printf(1), shell_builtins(1), tr(1), wc(1), ascii(5), attributes(5), environ(5), standards(5) NOTES
When representing an 8-bit character by using the escape convention n, the n must always be preceded by the digit zero(0). For example, typing: echo 'WARNING:7' will print the phrase WARNING: and sound the "bell" on your terminal. The use of single (or double) quotes (or two backslashes) is required to protect the "" that precedes the "07". Following the , up to three digits are used in constructing the octal output character. If, following the n, you want to echo addi- tional digits that are not part of the octal representation, you must use the full 3-digit n. For example, if you want to echo "ESC 7" you must use the three digits "033" rather than just the two digits "33" after the . 2 digits Incorrect: echo"0337 | od -xc produces: df0a (hex) 337 (ascii) 3 digits Correct: echo "00337" | od -xc produces: lb37 0a00 (hex) 033 7 (ascii) For the octal equivalents of each character, see ascii(5). SunOS 5.10 20 Jan 2000 echo(1)
All times are GMT -4. The time now is 02:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy