APLawrence - Information and Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds Get APLawrence.com by RSS











(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Home > Unix Articles > Bash auto_resume
Printer Friendly Version




Bash auto_resume



Recent versions of Bash have added functionality to the "auto_resume" variable. In older Bash versions, you could resume a stopped "vi" job (for instance) by typing "%vi". If you've never done this, try it now: vi some file, and hit CTRL-Z to suspend it. Type "%vi" and you'll be back editing your file.

The "auto_resume" variable lets you dispense with the "%". If you type "auto_resume=1", you can just type "vi" to resume the last job. That's not a great savings, but there is more. If you set "auto_resume=substring", you can them type any part of your job name to resume it.

For example, let's say you are running "vi /tmp/foo" and "vi /tmp/bar". If "auto_resume" is set to "substring", you can simply type "bar" to resume the second session or "foo" to resume the first. If you type "tmp", you'll resume whichever of those was started last.

When there are multiple jobs to choose from (if you just typed "vi"), the "substring" setting simply picks up the last job, With other settings, you'll get "ambiguous job spec".

Supposedly "auto_resume" can also take the value "exact". It's documented in the Bash man pages, and shows up in a "strings" of Bash right near "auto_resume":


..
simple-command
auto_resume
exact
substring
saved redirects
..
 

According to the manual, this means you must type the precise job:

   If  set to the value exact, the string supplied must match the
   name of a stopped job exactly;
 

I'm unable to make that work on any version of Bash I have available. Strangely, I can't find anything on the Internet indicating anyone else has noticed the problem. Perhaps I'm missing something obvious or perhaps no one has ever tried using this. The latter wouldn't surprise me: "substring" is a reasonably attractive feature, but "exact" seems almost pointless. Its only value might be to help you prevent yourself from trying to re-run something you already have in background.. as I said, almost pointless.

There's also the matter that few people read new man pages at all. Unless a feature adds considerable value, a large number of Bash users may be completely unaware of it. I only noticed this accidentally while looking up something completely unrelated.

If you can make "exact" work, please post a comment here. Include your Bash version (bash --version) and anything else you think is relevant.


Technorati tags:
If this page was useful to you, please click to help others find it:  
Your +1's can help friends, contacts, and others on the web find the best stuff when they search.


1 comment




More Articles by Anthony Lawrence - Find me on Google+



Click here to add your comments





Thu Apr 20 10:29:38 2006:   TonyLawrence

gravatar
Another factor is probably the diminished need to have job control at all. In the bad old days when we were stuck with non-windowing serial terminal connections, switching between background tasks was a fairly common need. Then we got tools like FacetTerm and shortly after that everything was networked so we could open as many windows as we wanted. It's rare to need to background a job at all today, never mind need to switch between several.






Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar



Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.


My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!


book graphic unix and linux troubleshooting guide




Buy Kerio from a dealer who knows tech: I sell and support

Kerio Connect Mail server, Control, Workspace and Operator licenses and subscription renewals
pavatar.jpg

This post tagged:

       - Linux
       - Shell
       - Unix




Unix/Linux Consultants

Skills Tests

Guest Post Here