Sponsored Content
Top Forums Shell Programming and Scripting Execute function as soon as input is provided in menu drive shell script Post 302975844 by RudiC on Monday 20th of June 2016 03:55:52 AM
Old 06-20-2016
Does your bash's read offer the -n option:
Quote:
-n nchars
read returns after reading nchars characters rather than waiting for a complete line of input, but honor a delimiter if fewer than nchars characters are read before the delimiter.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute interactive bash menu script in browser with PHP

I have an interactive menu script written in bash and I would like use PHP to open the interactive bash menu in a browser. Is this possible? Using the sytem() function in php runs the script but it's all garbled. Seems like maybe a terminal window needs to be opened in php first? ... (1 Reply)
Discussion started by: nck
1 Replies

2. Shell Programming and Scripting

How to use ssh execute other shell script on other host (shell script include nohup)?

i want use ssh on the host01 to execute autoexec.sh on the host02 like following : host01> ssh host02 autoexec.sh autoexec.sh include nohup command like follwing : nohup /home/jack/deletedata.sh & after i execute ssh host02 autoexec.sh one the host01. i can't found deletedata.sh... (1 Reply)
Discussion started by: orablue
1 Replies

3. Shell Programming and Scripting

Help to write a script or program to automatic execute and link input file data

Output file template format <input_file_name>a</input_file_name> <total_length_size>b</total_length_size> <log_10_length_size>c</log_10_length_size> Input_file_1 (eg. sample.txt) SDFSDGDGSFGRTREREYWW Parameter: a is equal to the input file name b is equal to the total length of... (2 Replies)
Discussion started by: perl_beginner
2 Replies

4. Shell Programming and Scripting

function from shell input

Hi all i have the command called printer which needs a usernmae for example i would run the commnad printer <username> how can i write i quick script in perl that if the username is ab then write "denined" and if it is anything else it will work thanks Adam (1 Reply)
Discussion started by: ab52
1 Replies

5. Shell Programming and Scripting

Shell Script to execute Oracle query taking input from a file to form query

Hi, I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database. For instance: USER CITY --------- ---------- A CITY_A B CITY_B C ... (2 Replies)
Discussion started by: DevendraG
2 Replies

6. UNIX for Dummies Questions & Answers

[ASK]execute shell with function in solaris

dear all i need your advice in shell with solaris i have testing script like this #!/usr/bin/bash function test(){ echo "testing only" } ## execute function ## test but if i running always got error like this test.sh: syntax error at line 1: `(' unexpected who can i running this... (7 Replies)
Discussion started by: zvtral
7 Replies

7. Shell Programming and Scripting

Want to use function and execute the below query in script.

#!/bin/bash function getDeliveredDispatches(firstDateTime, lastDateTime, limit) { var cursor = db.dispatches.find( {$and: }} ]}, {"deliveryGroupId" : 1, "batchId": 1, "statusHistory.code" : 1} ); var wrongDispatchesIds = ; print("Number of dispatches selected based on filter = " +... (2 Replies)
Discussion started by: neel2462
2 Replies

8. Shell Programming and Scripting

Script to select the rows from the feed file based on the input value provided

Hi Folks, I have the below feed file named abc1.txt in which you can see there is a title and below is the respective values in the rows and it is completely pipe delimited file ,. ... (3 Replies)
Discussion started by: punpun66
3 Replies

9. Shell Programming and Scripting

Need help to write a function in shell scripting to execute sql files

Hi, I am new to shell scripting and i need to write a automation script to execute sql files. I need to check the table if it is there in system tables and need to write a function to call the .sql files. For ex. I have a.sql,b.sql,c.sql files, where the sql file contains DELETE and INSERT... (1 Reply)
Discussion started by: Samah
1 Replies

10. UNIX for Beginners Questions & Answers

How to iterate Grep via all patterns provided in an input file?

When I use the following grep command with options -F and -f, its just displaying the text related to only the last pattern. Command: $ grep -f pattern_file.txt input_file.txt Output: doc-C2-16354 Even the following command yields the same output: Command: $ grep -Ff pattern_file.txt... (6 Replies)
Discussion started by: nsai
6 Replies
XTextExtents(3) 						  XLIB FUNCTIONS						   XTextExtents(3)

NAME
XTextExtents, XTextExtents16, XQueryTextExtents, XQueryTextExtents16 - compute or query text extents SYNTAX
int XTextExtents(XFontStruct *font_struct, char *string, int nchars, int *direction_return, int *font_ascent_return, int *font_descent_return, XCharStruct *overall_return); int XTextExtents16(XFontStruct *font_struct, XChar2b *string, int nchars, int *direction_return, int *font_ascent_return, int *font_descent_return, XCharStruct *overall_return); int XQueryTextExtents(Display *display, XID font_ID, char *string, int nchars, int *direction_return, int *font_ascent_return, int *font_descent_return, XCharStruct *overall_return); int XQueryTextExtents16(Display *display, XID font_ID, XChar2b *string, int nchars, int *direction_return, int *font_ascent_return, int *font_descent_return, XCharStruct *overall_return); ARGUMENTS
direction_return Returns the value of the direction hint (FontLeftToRight or FontRightToLeft). display Specifies the connection to the X server. font_ID Specifies either the font ID or the GContext ID that contains the font. font_ascent_return Returns the font ascent. font_descent_return Returns the font descent. font_struct Specifies the XFontStruct structure. nchars Specifies the number of characters in the character string. string Specifies the character string. overall_return Returns the overall size in the specified XCharStruct structure. DESCRIPTION
The XTextExtents and XTextExtents16 functions perform the size computation locally and, thereby, avoid the round-trip overhead of XQuery- TextExtents and XQueryTextExtents16. Both functions return an XCharStruct structure, whose members are set to the values as follows. The ascent member is set to the maximum of the ascent metrics of all characters in the string. The descent member is set to the maximum of the descent metrics. The width member is set to the sum of the character-width metrics of all characters in the string. For each charac- ter in the string, let W be the sum of the character-width metrics of all characters preceding it in the string. Let L be the left-side- bearing metric of the character plus W. Let R be the right-side-bearing metric of the character plus W. The lbearing member is set to the minimum L of all characters in the string. The rbearing member is set to the maximum R. For fonts defined with linear indexing rather than 2-byte matrix indexing, each XChar2b structure is interpreted as a 16-bit number with byte1 as the most significant byte. If the font has no defined default character, undefined characters in the string are taken to have all zero metrics. The XQueryTextExtents and XQueryTextExtents16 functions return the bounding box of the specified 8-bit and 16-bit character string in the specified font or the font contained in the specified GC. These functions query the X server and, therefore, suffer the round-trip over- head that is avoided by XTextExtents and XTextExtents16. Both functions return a XCharStruct structure, whose members are set to the val- ues as follows. The ascent member is set to the maximum of the ascent metrics of all characters in the string. The descent member is set to the maximum of the descent metrics. The width member is set to the sum of the character-width metrics of all characters in the string. For each charac- ter in the string, let W be the sum of the character-width metrics of all characters preceding it in the string. Let L be the left-side- bearing metric of the character plus W. Let R be the right-side-bearing metric of the character plus W. The lbearing member is set to the minimum L of all characters in the string. The rbearing member is set to the maximum R. For fonts defined with linear indexing rather than 2-byte matrix indexing, each XChar2b structure is interpreted as a 16-bit number with byte1 as the most significant byte. If the font has no defined default character, undefined characters in the string are taken to have all zero metrics. Characters with all zero metrics are ignored. If the font has no defined default_char, the undefined characters in the string are also ignored. XQueryTextExtents and XQueryTextExtents16 can generate BadFont and BadGC errors. DIAGNOSTICS
BadFont A value for a Font or GContext argument does not name a defined Font. BadGC A value for a GContext argument does not name a defined GContext. SEE ALSO
XLoadFont(3), XTextWidth(3) Xlib - C Language X Interface X Version 11 libX11 1.5.0 XTextExtents(3)
All times are GMT -4. The time now is 07:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy