[Solved] Abbreviations not working in vim

2010-10-02 1 min read Bash Learning Vim Tips

Today I found that abbreviations are not working in vim in my current login. I searched log of blog’s and sill did not find any solution so I decided to take the matters in my hand.

To start with I disabled all the plugin’s by moving my plugin directory. This did not help me solve the issue, so the only other option left was to now disable the vimrc file completely. Once I removed the vimrc file, the abbreviations started working.

Continue reading

bash script to run a command and take screenshot in every loop.

2010-09-24 2 min read Bash Fedora Learning Linux

Couple of days back, I had posted a command to display a stop timer with bash and echo. There I had also put the following gif file:

<img class="size-medium wp-image-2555" title="bash screenshot for the script output" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/09/temp-300x170.gif" alt="bash screenshot for the script output" width="300" height="170" />

Here the tricky part was to capture the jpg&#8217;s to create the gif file.

Preparation:

  1. Rename the terminal to aka – amit-capture

  2. Execute the command once with the import command and check the output and jpg&#8217;s

    Continue reading

bash – echo command with option to display the output on the same line.

2010-09-21 2 min read Bash Fedora Learning Linux

Here is a nice little trick to display the output in the same line :

  <td>
    <div class="bash codecolorer">
      &nbsp;<span class="kw3">echo</span> <span class="re5">-ne</span> <span class="st0">"output\<span class="es1">\r</span>"</span>
    </div>
  </td>
</tr>
1

The trick here is simple, first we disable the <a class="zem_slink" title="Newline" rel="wikipedia" href="http://en.wikipedia.org/wiki/Newline">newline printed by <a class="zem_slink" title="Echo (command)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Echo_%28command%29">echo command with the &#8221;-n&#8221; option and then we enable the interpretation of the <a class="zem_slink" title="Backslash" rel="wikipedia" href="http://en.wikipedia.org/wiki/Backslash">backslash characters with the &#8221;-e&#8221; option. As the &#8221;\r&#8221; is used as <a class="zem_slink" title="Carriage return" rel="wikipedia" href="http://en.wikipedia.org/wiki/Carriage_return">carriage return which brings you to the start of the line without the newline (like in <a class="zem_slink" title="Typewriter" rel="wikipedia" href="http://en.wikipedia.org/wiki/Typewriter">typewriter), we will use the same to get the desired effect. So, if you wanted a stopwatch for a 100 seconds on the console then this simple bash <a class="zem_slink" title="For loop" rel="wikipedia" href="http://en.wikipedia.org/wiki/For_loop">for loop would do the same:

Continue reading

cURL – Tutorial

2010-09-15 1 min read Bash Fedora Linux

Here are linkw to two nice tutorials on curl and how to use curl to login before we try to fetch a page. Hope you find them useful.
http://curl.haxx.se/docs/httpscripting.html

http://www.youtube.com/watch?v=XcgQUsorF_8

http://scriptasy.com/php_11/tutorial-curl-login_44.html

Enhanced by Zemanta

Handy one-liners for SED

2010-09-14 0 min read Bash Linux
\"A
Image via Wikipedia

Here are some links to sed one liners, pretty useful if you want to use the power of sed.

<a href="http://www.freearchive.org/o/dd1ebea77f64bdef5982d50e868990202b0bf6f21b42e26ebb0ab1011d6ce546">http://www.freearchive.org/o/dd1ebea77f64bdef5982d50e868990202b0bf6f21b42e26ebb0ab1011d6ce546

<a href="http://www.unixguide.net/unix/sedoneliner.shtml">http://www.unixguide.net/unix/sedoneliner.shtml
<a href="http://sed.sourceforge.net/sed1line.txt">http://sed.sourceforge.net/sed1line.txt <a href="http://www.thegeekstuff.com/2010/06/bash-array-tutorial/">

<a href="http://www.thegeekstuff.com/2010/06/bash-array-tutorial/">http://www.thegeekstuff.com/2010/06/bash-array-tutorial/<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://www.ibm.com/developerworks/linux/library/l-sed1.html">imabonehead: Common threads: Sed by example, Part 1 (ibm.com) <li class="zemanta-article-ul-li"><a href="http://www.thegeekstuff.com/2009/11/unix-sed-tutorial-append-insert-replace-and-count-file-lines/">imabonehead: Unix Sed Tutorial: Append, Insert, Replace, and Count File Lines (thegeekstuff.com) <div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=be4d9a3b-c27c-46eb-8b76-2a1aa1900a4e" alt="Enhanced by Zemanta" /><span class="zem-script more-related pretty-attribution">

Continue reading

Remove some path from the PATH variable temporarily.

2010-09-04 2 min read Bash Linux

How many times has it happened to you that you are working on some linux platform (like Fedora/Ubuntu/CentOS etc) and suddenly you see that you need to remove some path from the PATH variable so that a script is executed from some other path. It really difficult to do this if the path is too long and if you end up doing this couple of times. If that is the case, then the below script is for you 🙂

Continue reading

tee to a file descriptor

2010-08-13 1 min read Bash Linux

tee to a file descriptor

1
$ tee >(cat &#8211; >&2)

the tee command does fine with file names, but not so much with file descriptors, such as &2. This uses process redirection to tee to the specified descriptor.

In the sample output, it’s being used to tee to stderr, which is connected with the terminal, and to wc -l, which is also outputting to the terminal. The result is the output of bash –version followed by the linecount

Continue reading
Older posts Newer posts