06-11-2014
Yes you should definitely look at converting those 25 or so scripts to functions within the 1 script. It shouldn't require very much changes to the code to do this and the performance improvement should be immediately evident.
Also, with some careful redesign the performance of your bash script could end up very close to python for most functions.
I'm sure many people here can help in optimising bash code, but it may involve you posting some of your work here.
As an example most shell screen based I/O would use tput, which is an external program and costs a lot to call from bash.
A good idea is to avoid using $(tput rmso) everywhere in your script in printf/echo statements,
instead store this string once at the start of your script like this BOLD_OFF=$(tput rmso) and then use $BOLD_OFF everywhere else.
This User Gave Thanks to Chubler_XL For This Post:
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I want to display a system warning message at the prompt of every live terminal on a sun solaris 8 machine using CDE.
I know this can be done on a console, but what about dtterm and xterm regular windows?
Does anyone know how this is done?
What about a single terminal?
Clear skies,... (2 Replies)
Discussion started by: seismic_willy
2 Replies
2. UNIX for Advanced & Expert Users
Gurus,
I've been on computers for a while, but I've yet to have the behind-the-scenes knowledge. I'm not sure if this is so much a Unix question as it is a nitty gritty computer one.
We received a customer file which had a "funny apostrophe." When displaying the file via more, the character... (1 Reply)
Discussion started by: effigy
1 Replies
3. Shell Programming and Scripting
hi all,
am trying to 'grep' some text from a log file and use the 'cut' command to read from that line i just grep'ed to extract date/time and response times.
code sniplet i am using is :
grep -i 'text to grep' Out.log |
while read LINE;
do
... (11 Replies)
Discussion started by: cesarNZ
11 Replies
4. Shell Programming and Scripting
Hi all,
I would like to know how to have a color display in the terminal...
In the sense that,
In many linux terminals,we have color coded for each file type,
green for executable ,blue for dirs and so on...
I wanted to know how i can have the same arrangement in solaris(b-79a)
I am not... (5 Replies)
Discussion started by: wrapster
5 Replies
5. Windows & DOS: Issues & Discussions
Hi.
I was, not too long ago, an OS X home user. One of the things I remember from using the Apple-installed Terminal is: whenever an executable that took more than a split second to do its thing was running, its name would appear in the title bar in a way similar to "Terminal: ssh" or "Terminal:... (0 Replies)
Discussion started by: SilversleevesX
0 Replies
6. Shell Programming and Scripting
Hello all,
I would like a message to be displayed on the shell when someone opens up the terminal - something like a welcome msg with date and time. I know how to do this by running the shell commands but dont know how to display it when a user opens up the terminal?
Thanks in advance (27 Replies)
Discussion started by: mrudula009
27 Replies
7. UNIX for Advanced & Expert Users
Hello,
I am doing fluid simulations using OpenFOAM. This program produces a lot of output every time step.
Producing output is surely not the most time consuming part, but I wonder whether writing output to the terminal or writing it into a file is faster.
With thousands of time steps a... (1 Reply)
Discussion started by: Chuck Morris
1 Replies
8. UNIX for Advanced & Expert Users
Want few input related to unix environment and terminal settings:
1. Am trying to find a way to keep the unix terminal display intact even after opening and closing a vi/less file. Currently if I open a vim file in the unix terminal and then close the file,it displays the contents of vim file on... (4 Replies)
Discussion started by: talktovkjain
4 Replies
9. Homework & Coursework Questions
I would like to get an opinion for my solution for this task and get feedback about better approach or mistakes I have made.
1. The problem statement, all variables and given/known data:
The task is to create a script which prints information about users whose names are specified in the... (2 Replies)
Discussion started by: kornfan
2 Replies
10. Shell Programming and Scripting
Hi,
Anyone can help I am just converting the excel file to csv using python, I can get the conversion output but the date not display exactly.
test.xlsx date format
167 1588 risks/SCS JP CAMPANA & CIE.pdf SCS JP CAMPANA & CIE 2 1 1 0 2015-03-16 16:56:25
167 1146 risks/AirBNB... (1 Reply)
Discussion started by: fspalero
1 Replies
clear(1) General Commands Manual clear(1)
NAME
clear - clear the terminal screen
SYNOPSIS
clear [-Ttype] [-V] [-x]
DESCRIPTION
clear clears your screen if this is possible, including its scrollback buffer (if the extended "E3" capability is defined). clear looks in
the environment for the terminal type given by the environment variable TERM, and then in the terminfo database to determine how to clear
the screen.
clear writes to the standard output. You can redirect the standard output to a file (which prevents clear from actually clearing the
screen), and later cat the file to the screen, clearing it at that point.
OPTIONS
-T type
indicates the type of terminal. Normally this option is unnecessary, because the default is taken from the environment variable TERM.
If -T is specified, then the shell variables LINES and COLUMNS will also be ignored.
-V reports the version of ncurses which was used in this program, and exits. The options are as follows:
-x do not attempt to clear the terminal's scrollback buffer using the extended "E3" capability.
HISTORY
A clear command appeared in 2.79BSD dated February 24, 1979. Later that was provided in Unix 8th edition (1985).
AT&T adapted a different BSD program (tset) to make a new command (tput), and used this to replace the clear command with a shell script
which calls tput clear, e.g.,
/usr/bin/tput ${1:+-T$1} clear 2> /dev/null
exit
In 1989, when Keith Bostic revised the BSD tput command to make it similar to the AT&T tput, he added a shell script for the clear command:
exec tput clear
The remainder of the script in each case is a copyright notice.
The ncurses clear command began in 1995 by adapting the original BSD clear command (with terminfo, of course).
The E3 extension came later:
o In June 1999, xterm provided an extension to the standard control sequence for clearing the screen. Rather than clearing just the vis-
ible part of the screen using
printf '