blog/content/2012/03/2012-03-08_some-bash-tips.rst

27 lines
1.9 KiB
ReStructuredText
Raw Normal View History

2022-10-17 01:59:22 +00:00
Some BASH tips
##############
:date: 2012-03-08 03:56
:author: tyrel
2022-10-17 03:02:04 +00:00
:category: Tech
:tags: bash, linux
2022-10-17 03:34:35 +00:00
:slug: 2012-03-08-some-bash-tips
2022-10-17 01:59:22 +00:00
:status: published
I realize I havent updated in a while. I havent had much free time recently as Ive been working on a project for my father in C# after work hours. This is a great change from only working in Python and JavaScript recently. Im making a program that will analyze test results from a plasma torch for a company called HyperTherm. My father built the physical machine, but the employees want something that they can better see the results of a passed torch unit, or a failed torch unit. This program has a bar code scanner that scans the tool used in the test and matches it up to the lot of torch parts. Another added feature is the ability to print a white label that says “UNIT PASSED” or a giant red label that says the unit failed and which of the 8 tests failed were. I had to learn how to use delegates, as my serial event listener is on a separate thread and I cant update labels, or parts of the User Interface without them.  Still working on it, hopefully will wrap it up by Saint Patricks day.
I recently found a cool command in BASH that I hadnt previously known.  C-o will execute the current line, and then bring the following line up from BASH history. If you have a set of commands you want to execute again, rather than having to press up 20 times, hit enter, press up 19 times, hit enter, and so on… You can just hit up 20 times. Press C-o as many times as you need to.
| For example
.. code:: console
tacidsky@ip-234:~$ touch a
tacidsky@ip-234:~$ touch b
tacidsky@ip-234:~$ touch c
# [up] [up] [up]
tacidsky@ip-234:~$ touch a [C-o]
tacidsky@ip-234:~$ touch b [C-o]
tacidsky@ip-234:~$ touch c [C-o]
As you can see there, all I had to do was go back to the \`touch a\` line, and hit control-o three times and it touched the files again!