473,761 Members | 10,684 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

symbolic links, aliases, cls clear

mp
i have a python program which attempts to call 'cls' but fails:

sh: line 1: cls: command not found

i tried creating an alias from cls to clear in .profile, .cshrc, and
/etc/profile, but none of these options seem to work.

my conclusion is that a python program that is executing does not use
the shell (because it does not recognize shell aliases). is this
correct?

should i use a symbolic link? if so, where should i place it?

what is the difference between aliases and symbolic links?

if i execute a command like 'clear' to clear the screen, where does the
shell look to find the command 'clear'?

i'm using os x.

thanks
mp

Mar 29 '06
22 4239
fl***@apaflo.co m (Floyd L. Davidson) writes:
af******@gmail. com wrote:
If I may recommend an alternative,

print "\033[H\033[J"

the ansi sequence to clear the screen.


Or so you would hope (however, that is *not* what you have listed!).

Unfortunately, it is poor practice to hard code such sequences.
Instead the proper sequence should be obtained from the
appropriate database (TERMINFO or TERMCAP), and the easy way to
do that is,

tput clear


(Or "clear".)

On the other hand, I think it's been at least a decade since I've used
a terminal or emulator that's not VT100-compatible (i.e., accepts ANSI
control sequences).

Of course, I'll run into one the day after I start writing code that
depends on that assumption.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Apr 12 '06 #11
On 2006-04-12, Floyd L. Davidson wrote:
af******@gmail. com wrote:
If I may recommend an alternative,

print "\033[H\033[J"

the ansi sequence to clear the screen.
Or so you would hope (however, that is *not* what you have listed!).

Unfortunately, it is poor practice to hard code such sequences.


I was bitten by that shortly after I started shell scripting.
However, since all such code was isolated in functions, converting
to a new terminal type was simple -- and quick.

These days, the ISO-6429 standard (almost the same as the older
ANSI x3.64) is so close to universal that I don't bother writing
for anything else any more. If the need arises, I'll do it, but it
will be simple to do, and much faster (both in coding and script
execution) than trying to accommodate all terminals from the start.
Instead the proper sequence should be obtained from the
appropriate database (TERMINFO or TERMCAP), and the easy way to
do that is,

tput clear


I still have a system which does not have tput.

--
Chris F.A. Johnson, author | <http://cfaj.freeshell. org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
Apr 12 '06 #12
Keith Thompson <ks***@mib.or g> wrote:
fl***@apaflo.c om (Floyd L. Davidson) writes:
af******@gmail. com wrote:
If I may recommend an alternative,

print "\033[H\033[J"

the ansi sequence to clear the screen.
Or so you would hope (however, that is *not* what you have listed!).

Unfortunately, it is poor practice to hard code such sequences.
Instead the proper sequence should be obtained from the
appropriate database (TERMINFO or TERMCAP), and the easy way to
do that is,

tput clear


(Or "clear".)


But /clear/ merely uses "tput clear".
On the other hand, I think it's been at least a decade since I've used
a terminal or emulator that's not VT100-compatible (i.e., accepts ANSI
control sequences).

Of course, I'll run into one the day after I start writing code that
depends on that assumption.


However, if you check out the various TERMINFO database entries for an
assortment of "VT100-compatible" terminals, you *will* find variation!

Plus, if a user has customized a terminal database, for who knows what
reason...

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) fl***@apaflo.co m
Apr 12 '06 #13
On 2006-04-12, Floyd L. Davidson wrote:
Keith Thompson <ks***@mib.or g> wrote:
tput clear


(Or "clear".)


But /clear/ merely uses "tput clear".


Not on systems without tput.

--
Chris F.A. Johnson, author | <http://cfaj.freeshell. org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
Apr 12 '06 #14
jpd
Begin <j4************ @xword.teksavvy .com>
On 2006-04-12, Chris F.A. Johnson <cf********@gma il.com> wrote:
These days, the ISO-6429 standard (almost the same as the older
ANSI x3.64) is so close to universal that I don't bother writing
for anything else any more.
Oh, wonderful. ``All the world's a vax^W^WISO-6429 compatible'' all over
again.

If the need arises, I'll do it, but it will be simple to do, and
much faster (both in coding and script execution) than trying to
accommodate all terminals from the start.
Yes, why use a perfectly good abstraction when you can hardcode stuff.

I still have a system which does not have tput.


And that justifies everything else. Of course.
--
j p d (at) d s b (dot) t u d e l f t (dot) n l .
This message was originally posted on Usenet in plain text.
Any other representation, additions, or changes do not have my
consent and may be a violation of international copyright law.
Apr 12 '06 #15
On 2006-04-12, jpd wrote:
Begin <j4************ @xword.teksavvy .com>
On 2006-04-12, Chris F.A. Johnson <cf********@gma il.com> wrote:
These days, the ISO-6429 standard (almost the same as the older
ANSI x3.64) is so close to universal that I don't bother writing
for anything else any more.


Oh, wonderful. ``All the world's a vax^W^WISO-6429 compatible'' all over
again.
If the need arises, I'll do it, but it will be simple to do, and
much faster (both in coding and script execution) than trying to
accommodate all terminals from the start.


Yes, why use a perfectly good abstraction when you can hardcode stuff.


If it were perfectly good, there would be no question; however,
it's not.
I still have a system which does not have tput.


And that justifies everything else. Of course.


If I want to write portable scripts, then yes, it does.

--
Chris F.A. Johnson, author | <http://cfaj.freeshell. org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
Apr 12 '06 #16
"Chris F.A. Johnson" <cf********@gma il.com> wrote:
On 2006-04-12, Floyd L. Davidson wrote:
Keith Thompson <ks***@mib.or g> wrote:
tput clear

(Or "clear".)


But /clear/ merely uses "tput clear".


Not on systems without tput.


Shoot that thing, and put it (and yourself) out of its misery.

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) fl***@apaflo.co m
Apr 12 '06 #17
On Wed, 12 Apr 2006 15:59:05 -0400, rumours say that "Chris F.A. Johnson"
<cf********@gma il.com> might have written:
I still have a system which does not have tput.


And that justifies everything else. Of course.


If I want to write portable scripts, then yes, it does.


Well, either port your system out of the window or port tput.c to your
system and then start writing "portable" scripts. tput is part of the POSIX
1003.1 standard, and guess what the 'P' stands for in POSIX.

If you insist, I will retort to using Terry Pratchett references.
--
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
Apr 12 '06 #18
On 2006-04-12, Christos Georgiou wrote:
On Wed, 12 Apr 2006 15:59:05 -0400, rumours say that "Chris F.A. Johnson"
<cf********@gm ail.com> might have written:
I still have a system which does not have tput.

And that justifies everything else. Of course.
If I want to write portable scripts, then yes, it does.


Well, either port your system out of the window or port tput.c to your
system and then start writing "portable" scripts. tput is part of the POSIX
1003.1 standard, and guess what the 'P' stands for in POSIX.


It may be part of the POSIX standard, but there's nothing in the
POSIX definition of tput that provides for cursor positioning or
font attributes. The only defined operands are clear, init and
reset.

In fact, my scripts are portable to other terminal types by use
of files for each terminal, generated with tput. Using a
different terminal is as easy as ". /usr/share/term-sh/$TERM" or
something similar. I generated a lot of files a few years ago,
but I have never had any call for them, so I'd have to hunt for
them.
If you insist, I will retort to using Terry Pratchett references.


UNCLE!

--
Chris F.A. Johnson, author | <http://cfaj.freeshell. org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
Apr 13 '06 #19
In article <go************ @xword.teksavvy .com>,
"Chris F.A. Johnson" <cf********@gma il.com> wrote:
In fact, my scripts are portable to other terminal types by use
of files for each terminal, generated with tput. Using a
different terminal is as easy as ". /usr/share/term-sh/$TERM" or
something similar. I generated a lot of files a few years ago,
but I have never had any call for them, so I'd have to hunt for
them.


So you've essentially reinvented the whole termcap/terminfo mechanism?

--
Barry Margolin, ba****@alum.mit .edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Apr 13 '06 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3792
by: ozarks | last post by:
I want to setup a database symbolic link within Windows XP to a network drive which has significanlty more space available and can't seem to get it working. Here is my setup.... - I am running MySQL 4.1.7 - I have tried this with both the 'mysqld-max' and 'mysqld-max-nt' servers - Per the MySQL manual (section 7.6.1.3) I setup a 'foo.sym' file in
0
1292
by: Mark Everett | last post by:
Hi, I am runnign the latest version of mysql and I desperately need to move one of my tables from a database so that it is stored on another drive. I have read the symbolic links reference but it seems to me that I can relocate a database but not a table. Which is not useful to me at all. I have tried anyhow without any success.
15
2453
by: jacob navia | last post by:
Recently, we had a very heated thread about GC with the usual arguments (for, cons, etc) being exchanged. In one of those threads, we came into the realloc problem. What is the realloc problem? Well, it begins with a successfull realloc: char *q = realloc(p,2*n); // for n size_t, a simple
4
3375
by: TK | last post by:
Hi, I have to know whether a typical file (under Linux) a symbolic link is (in the sense of the stat()-Funktion). How can I check it excactly? Thanks for help. o-o THomas
0
1386
by: humbleaptience | last post by:
Hey Ya'll, I basically have a bunch of unix servers with a dataset scrambled through about 10 of them. On unix, I maintain a symbolic link file tree so that for each server it appears to have access to all the files through auto mounting and so forth. I want to be able to access this same file tree from my asp.net web app and NFS - however, it's not working and I've tried everything. Microsoft Services for Unix just doesn't cut it...
0
1577
by: xhunga | last post by:
* Symbolic computation with the language c : The Derivative step by step. (Windows,Linux) You can find some examples into the file a_exampl.txt @ @
1
3491
by: Remote_User | last post by:
Hi All, .NET 1.1 doesn't support creating symbolic links to files, like in Linux? Can i use C# to make a file point to another file? Thanks.
1
8360
by: amygrant1701 | last post by:
Hi, I've done this before so I don't see what I could doing wrong here. I'm running mysql 5x on freebsd. I'm using the default data directory of "/var/db/mysql" In there I have several dozen mysql datasbases that are functioning perfectly. I am trying to add a database which will be stored on a different drive, therefore the entry in "/var/db/mysql" should be a symbolic link
2
2868
by: Desmodromic | last post by:
Informix recommend that symbolic links be used for chunks. These links are then used in the dbspace definition. Does this advice hold for DB2? The equivalent would be to create symbolic links for containers and use the link name when defining tablespaces. Wouldn't this allow containers to be physically moved/ renamed without having to use db2relocatedb? I haven't tested this but couldn't you just remove the link, move the container,...
0
9521
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9333
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10107
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9900
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7324
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5361
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3442
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.