Sponsored Content
Top Forums Shell Programming and Scripting [BASH] Performance question - Script to STDOUT Post 302907543 by sea on Sunday 29th of June 2014 10:31:20 PM
Old 06-29-2014
Sorry and thank you.
I was sick for a week and had troubles with several services i didnt want to solve until i was healthy again.. medics-brain and such combinations...
This must have 'passed' my 'awarness' today, but my system is working again.

While i will apply your suggestions (its 4am atm, so it'll be after sleep & understanding them), i can say already, it'll remain in just that script, as the display must (also) match (possible changing) GUI terminal lengths...
If it'd be a 'pre-loaded' env variable, it'll always be either the max lenght, or the lenght of the terminal window upon call, but never ever be the matching length once the terminal window was (if/when) resized once or more times.

Of which i fail to see/provide the requirements if i'd place it in /etc/prfile.d/tui.sh, eventhough i see the performance bonus by ITSELF , it looses its USAGE bonus overall... -> thus the -z $VAR, which i thought to be the fastest check...
-->
Quote:
Originally Posted by Chubler_XL
Please consider making tui-printf a function definition in this file and sourcing it in any client code, as this is a recursive routine and called many times from each client, you will benefit from not loading a new shell each time it is used.
Not really understanding... are you saying, sourcing an additional script, just containing the ($WIDTH) code, is faster than leaving the code in the file that is actualy executed?
Keep in mind, tui-echo, tui-header, tui-title, tui-status, etc, are ALL calling --just-- tui-printf, making that 'application-script' sourcing an addition file, makes the complete procedure (mechanicly) slower, or am i wrong?

Maybe the two lines are just one, its late. Smilie

EDIT5orso...
I've have had a function called printx provided in the script '/bin/tui' which was sourced instead of /etc/profile.d/tui.sh, but in combination with the other things, specialy using that function for its main prupsose.. printf... was slower than it is now.
Since tui-rpintf required tui to be source, so the function was available, this way around, tui-printf IS the function, available right from the terminal, rather than having to source something first.

Please correct me if i'm 'wrong', that was just my testet (1-3x) experience.

EDIT 6 -- PPS-Notes:
/etc/profile.d/tui.sh: Provides only 'hard-coded' and for reusage defined variables.
$WIDTH is very flexible on its definition, that is absolute true in GUI mode with one or more terminal-windows open that may or may not be on the same screen, and due to the GUI be resized to the pleasure/need of the user.

EDIT for Don:
Sorry, seems one of my Firefox addins/plugins scratches that display functionality...

Last edited by sea; 06-30-2014 at 12:15 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

BASH shell script question

I want to make shell script that takes a list of host names on my network as command line arguments and displays whether the hosts are up or down, using the ping command to display the status of a host and a for loop to process all the host names. Im new to shell scripting so Im not quite sure... (3 Replies)
Discussion started by: ewarmour
3 Replies

2. Shell Programming and Scripting

one question for bash shell script

Just one question for bash shell script. In bash script, you can use *.txt to call any files in current folder that ends with .txt, like rm *.txt will remove all txt file in current folder. My question is can you actually remember or use the file name among *.txt, I know file=*.txt will not... (9 Replies)
Discussion started by: zx1106
9 Replies

3. Shell Programming and Scripting

BASH script question

Hi, I want to create a script that gets a filename as an argument. The script should generate a listing in long list format of the current directory, sorted by file size. This list must be written to a new file by the filename given on the command line. Can someone help me with this? ... (6 Replies)
Discussion started by: I-1
6 Replies

4. Shell Programming and Scripting

bash script question

Can anybody be kind to explaing me what the lines below mean ? eval line=$line export $line ] || echo $line (2 Replies)
Discussion started by: jville
2 Replies

5. Shell Programming and Scripting

bash, help with stdout manipulation.

Hey all, Im kind of lost on how to do what I want so I figured I would ask. I want to pipe STDOUT of an app to a log file, but I want to prepend each line of that output with the date and time. Im drawing a complete blank on how to do this?? Any ideas? i.e. output is currently this:... (9 Replies)
Discussion started by: trey85stang
9 Replies

6. Shell Programming and Scripting

Mkbootfs writing to stdout in bash script

Hi, I need to automate some repacking tasks of a boot image for Android When in command line, I can use this command: mkbootfs /path/to/root > /path/to/ramdisk-recovery.cpio;However, if I try to run the command from a shell script under Ubuntu, it fails and outputs to stdout instead of the... (27 Replies)
Discussion started by: Phil3759
27 Replies

7. Shell Programming and Scripting

Question in bash script.

Hi All, I need an assistance with the issue below. I wrote big script in "bash" that automatically install an LDAP on Clients. I'd be happy to know in order to avoid duplication of entries in files, How i can define into the script, if the specific expressions already exist in the file, do... (7 Replies)
Discussion started by: Aviel.shani
7 Replies

8. Shell Programming and Scripting

Question about writing a bash script

Hello, I want to write a bash script to delete the content after '#'. However, if '#' appears in a string with "", ignore this. For example, input file: test #delete "test #not delete" Output file: test "test #not delete" Does anyone know how to write this script? Thanks (1 Reply)
Discussion started by: jeffwang66
1 Replies

9. Shell Programming and Scripting

Bash Script Iterating Question

I am trying to look through one of my directories to remove certain files. I am pretty new to Unix and bash so I just need a little help in starting this. I know I would have to write two loops one to iterate the directories and one to iterate the files. How would I write the loops? (3 Replies)
Discussion started by: totoro125
3 Replies

10. Shell Programming and Scripting

Bash script search, improve performance with large files

Hello, For several of our scripts we are using awk to search patterns in files with data from other files. This works almost perfectly except that it takes ages to run on larger files. I am wondering if there is a way to speed up this process or have something else that is quicker with the... (15 Replies)
Discussion started by: SDohmen
15 Replies
All times are GMT -4. The time now is 10:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy