Features of the TCSH Shell
In many cases the list should be calculated when the completion takes place. For example, a list of users located at a given host or targets in a makefile would need to be calculated.
To set up such a completion, first develop the command which returns the list to complete from. The command must return the completion list on standard output as a space-separated list. When this is done, insert this command in the entry Output From Command.
Here's a little Perl command which finds the targets in a makefile:
perl -ne 'if (/^([^.#][^:]+):/) {print "$1 "}'
Makefile
If this is inserted in the entry, you can complete on targets from the file
called Makefile in the current working directory.
If someone should think I describe TCSH through it only in order
to promote TDG,(s)he should take a look at the following line, which is the
generated code for the make completion:
complete make 'p@*@`perl -ne \
'"'"'>if (/^([^.#][^:]+):/) \
{print "$1"}'"'"'Makefile`@'
With user-defined completion, you can restrict the files which are matched for each command. Here are two very useful examples:
Restrict latex to *.{tex,dtx,ins} The latex command will complete only on files ending in the extensions .tex, .dtx or .ins.
Restrict rm to ^*.{tex,html,c,h}.` This means that you cannot complete rm to a .tex, .html, .c or .h file. I've done that a few times, when I wanted to delete a file called important.c~. Since the file important.c existed, TCSH completed only to that name, and... I deleted the wrong file, because I was too quick.
Additional examples can be obtained by loading the export file distributed with TDG. Please note that if you wish to keep the other pages, you have to tell TDG to import only the page completion/userdefined. This is done on the Details page, which is accessible from the reload page.
Configuring the prompt is very easy with TDG. Just enter the menu called prompt. On this page you can configure three prompts:
prompt: the usual prompt, which you see on the command line, where you are about to enter a command
prompt2: is used in foreach, and while loops, and at lines continuing lines ended with a slash
prompt3: is used when TCSH tries to help you, when it meets commands it doesn't know—i.e., spell checking
The prompts are mixed with tokens and ordinary text. The tokens are inserted by clicking on them in the menu below the scrollbar, and the ordinary text is simply typed in. When a token is inserted, an indication will be shown in the entry. Figure 4 is an example of how this may look.
Some of the prompts may be positioned in the xterm title bar instead of on the command line. To do this, choose font change and select Xterm.
The history mechanism of the shell makes it easier to type similar commands after each other. To see a list of the previously executed commands, type history.
The following table lists the event specifiers:
!n | This refers to the history event, with index n |
!-n | This refers to the history event which was executed n times ago: !-1 for the previous command, !-2 for the one before the previous command, etc. |
!! | This refers to the previous command |
!# | This refers to the current command |
!s | This refers to the most recent command whose first word begins with the string s |
!?s? | This refers to the most recent command which contains the string s |
With these event specifiers, you can re-execute a command, e.g., just type !!, to re-execute the previous command. However, this is often not what you want to do. What you really want is to re-execute some part of a previous command, with some new elements added. To do this, you can use one of the following word designators, which is appended to the event specifier with a colon.
0 | The first word, i.e., the command name |
n | The nth word |
$ | The last argument |
% | The word matched by an ?s? search |
x-y | Argument range from x to y |
* | All the arguments to the command (equal to ^-$) |
Now it's possible to get the last argument from the previous command, by typing !!:$. You'll often see that you need to refer to the previous command, so if no event specifier is given, the previous command is used. This means that instead of typing !!:$, you need type only !$.
More word designators exist, and it's even possible to edit the words with different commands. For more information and examples, please take a look at the TCSH manual found on-line at http://www.imada.ou.dk/Technical/Manpages/tcsh/History_substitution.html.
It is possible to expand the history references on the command line before you evaluate them by pressing ESC-SPC or ESC-!. (That is: first the escape key, and next the space bar or the ! key). On some keyboards you may use the meta key instead of the ESC key, i.e., M-SPC (one keystroke).
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- Designing Electronics with Linux
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Dynamic DNS—an Object Lesson in Problem Solving
- Using Salt Stack and Vagrant for Drupal Development
- New Products
- Why Python?
- A Topic for Discussion - Open Source Feature-Richness?
- Build a Skype Server for Your Home Phone System
- Validate an E-Mail Address with PHP, the Right Way
- Tech Tip: Really Simple HTTP Server with Python




42 min 27 sec ago
3 hours 12 min ago
13 hours 14 min ago
17 hours 41 min ago
21 hours 17 min ago
21 hours 50 min ago
1 day 13 min ago
1 day 16 min ago
1 day 18 min ago
1 day 4 hours ago