Sponsored Content
Top Forums Shell Programming and Scripting Last line in while do function being ignored Post 303016311 by Hvieira on Tuesday 24th of April 2018 12:00:07 PM
Old 04-24-2018
Last line in while do function being ignored

Hello everyone,

I'm practically new to scripting (first post here), so I'm having just a slight issue running the code snippet below correctly.

Here's the flow: An email is received such as this one:

Quote:
Your name: Test User
Email: test.usertestingthisstuff.com
Subject: Help
Description: Describe me in 2 words
Then copy its contents and run the script below:



Code:
read -p "Ticket ID:" ticketidvar

while read line ; do

     case "$line" in

	"Your name:"*)   uservar="${line#*: }" ;;
	"Email:"*)       emailvar="${line#*: }" ;;
	"Subject:"*)     subject="${line#*: }" ;;
	"Description:"*) description="${line#*: }" ;;

     esac
	
done < <( pbpaste )

echo ""
echo "Details:"
echo ""
echo "Name:" $uservar
echo "E-mail:" $emailvar
echo "Subject:" $subject
echo "Description:" $description
echo "Ticket ID:" $ticketidvar


What happens here is that I manually enter the ticket id (unrelated to this) and then the remaining fields are stored as variables.

The issue here is that the Description field is not being saved as a variable. It doesn't display anything at all.

All fields are stored as variables, except this one.

Can you guys help, please?
Thank you Smilie
 

10 More Discussions You Might Find Interesting

1. AIX

function trace back and address to line number conversion

Hi, I am new to AIX and I am developing a small tool for our product which helps debug memory leaks etc. Q1)Is there a way in which i can get a function trace back as to the call (lets say malloc() )has been made in which file--> in which function. I tried using the #pragma options (... (0 Replies)
Discussion started by: Wkdunreal
0 Replies

2. Shell Programming and Scripting

How to send a function all command line args?

I have this code, I thought it would automatically know the args sent to script when called from shell. But it seems to not see any... main script: . args . errors . opt . clean dbfile="" opfile="" # calls function in script below chkarg #check commands (2 Replies)
Discussion started by: gcampton
2 Replies

3. Homework & Coursework Questions

I need to make a script that has 4 command line arguments to function properly.

I have no idea what the following means. The teacher is too advanced for me to understand fully. We literally went from running a few commands over the last few months to starting shell scripting. I am not a programmer, I am more hardware oriented. I wish I knew what this question was asking... (3 Replies)
Discussion started by: Wookard
3 Replies

4. Shell Programming and Scripting

[SOLVED] Awk one line to sum up a function

I need help with debugging an error in my awk script. I have a shell script with variable named U_new_i and want to pass it to awk for use in a summation. The original file have the following content. cat test.txt -2445.7132000000 -2444.9349000000 -2444.3295000000 -2443.1814000000 ... (0 Replies)
Discussion started by: Quantum_Dot
0 Replies

5. Shell Programming and Scripting

Help reading each line and in a function

I have a text file with file names, id like to have this portion of my BASH script go grab the line (which in this case is the full path to my file) then cat that file so I could pipe it to a email. 1) My text file (/tmp/1.txt) is setup like this: ... (3 Replies)
Discussion started by: binary-ninja
3 Replies

6. Programming

Why does gdb stop at a different line than “i b” shows while returning from function?

Here is the program I am trying to debug: #include <stdio.h> int i = 5; int main(void) { int x = 3; display(x); return 0; } void display(int x) { for ( i=0; i<x; ++i ) { printf("i is %d.\n", i); } }This code is coming from here Peter's gdb Tutorial: Stepping... (2 Replies)
Discussion started by: ijustneeda
2 Replies

7. Shell Programming and Scripting

Avoid single line output from function

I am new to shell scripting and wished to get few things clarified. While calling functions within shell script, output comes out as single line irrespective of the no of echos or newlines I tried within function + the echo -e used to invoke function ( as instructed online) : #!/bin/sh inc() {... (1 Reply)
Discussion started by: RMath
1 Replies

8. How to Post in the The UNIX and Linux Forums

GREP function in ksh which ignores LINE Breaks

I am using a grep command with two patterns in my KSH script. File has line breaks in it and both the patterns are in different lines. Here is the command - grep -l 'RITE AID.*ST.820' natriter820u.20140914 Pattern1 - RITE AID Pattern2 - ST*820 I am not getting any results from this,... (3 Replies)
Discussion started by: Raghav Garg
3 Replies

9. UNIX for Dummies Questions & Answers

GREP function in ksh which ignores LINE Breaks

Hello I am using a grep command with two patterns in my KSH script. File has line breaks in it and both the patterns are in different lines. Here is the command grep -l 'RITE AID.*ST.820' natriter820u.20140914 Pattern1 - RITE AID Pattern2 - ST*820 I am not getting any results from... (24 Replies)
Discussion started by: Raghav Garg
24 Replies

10. UNIX for Beginners Questions & Answers

How to find encapsulating function name from line number?

I am looking at a log file which just tells me the filename and the line number inside that file that has the Error. What I am interested is knowing the encapsulating function. For example, here are the contents of the log file Error: foo.file on line wxy Error: foo.file... (3 Replies)
Discussion started by: kaaliakahn
3 Replies
XmSetProtocolHooks(3X)													    XmSetProtocolHooks(3X)

NAME
XmSetProtocolHooks - A VendorShell function that allows pre and post actions to be executed when a protocol message is received from MWM SYNOPSIS
#include <Xm/Xm.h> #include <Xm/Protocols.h> void XmSetProtocolHooks (shell, property, protocol, prehook, pre_closure, posthook, post_closure) Widget shell; Atom property; Atom protocol; XtCallbackProc prehook; XtPointer pre_closure; XtCallbackProc posthook; XtPointer post_closure; void XmSetWMProtocolHooks (shell, protocol, prehook, pre_closure, posthook, post_closure) Widget shell; Atom protocol; XtCallbackProc prehook; XtPointer pre_closure; XtCallbackProc posthook; XtPointer post_closure; DESCRIPTION
XmSetProtocolHooks is used by shells that want to have pre and post actions executed when a protocol message is received from MWM. Since there is no guaranteed ordering in execution of event handlers or callback lists, this allows the shell to control the flow while leaving the protocol manager structures opaque. XmSetWMProtocolHooks is a convenience interface. It calls XmSetProtocolHooks with the property value set to the atom returned by interning WM_PROTOCOLS. Specifies the widget with which the protocol property is associated Specifies the protocol property Specifies the protocol atom (or an int cast to Atom) Specifies the procedure to call before calling entries on the client callback-list Specifies the client data to be passed to the prehook when it is invoked Specifies the procedure to call after calling entries on the client callback-list Specifies the client data to be passed to the posthook when it is invoked For a complete definition of VendorShell and its associated resources, see VendorShell(3X). SEE ALSO
VendorShell(3X), XmInternAtom(3X), XmSetWMProtocolHooks(3X) XmSetProtocolHooks(3X)
All times are GMT -4. The time now is 10:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy