Posts Tagged bash

Put Filenames in Bash Array

📅 April 8, 2017
Bash arrays can be tricky, so here are a few hints to aid understanding.

Read the rest of this entry »

Advertisements

,

Leave a comment

ncal – A Command-Line Calendar

ncal1Need a quick calendar? Try ncal – a command-line program that displays a calendar in your terminal.

 

 

 

Read the rest of this entry »

,

Leave a comment

Computer Trivia: Amp Off

📅 January 14, 2015
ampoffHere is a computer term rarely heard these days: amp off.

To amp off means to run in the background, and it is derived from the ampersand character (& or amp) placed at the end of a command line in a Linux or UNIX terminal.

Read the rest of this entry »

, ,

Leave a comment

Produce Fancy Text With Figlet

May 30, 2014
figletDo you want to spruce up your readme files with fancy titles and styled text? Figlet will help!

Figlet is a command line program that styles a given line of text with a font of your choosing, so you can from this,

Welcome Figlet!

to this:

 __        __   _                            _____ _       _      _   _
 \ \      / /__| | ___ ___  _ __ ___   ___  |  ___(_) __ _| | ___| |_| |
  \ \ /\ / / _ \ |/ __/ _ \| '_ ` _ \ / _ \ | |_  | |/ _` | |/ _ \ __| |
   \ V  V /  __/ | (_| (_) | | | | | |  __/ |  _| | | (_| | |  __/ |_|_|
    \_/\_/ \___|_|\___\___/|_| |_| |_|\___| |_|   |_|\__, |_|\___|\__(_)
                                                     |___/

Read the rest of this entry »

, , ,

Leave a comment

File Immutable Attribute

Do you need to set a file so nobody can delete or edit it? Simple! Set the immutable attribute on the file.

Suppose you have an important info.txt file, a frequently asked questions file, a set of instructions, or even installation scripts that exist on a Samba share. Perhaps these files are accessible via SSH or FTP where write permissions are granted. In any case, they must not be deleted or tampered with, even by root.

Read the rest of this entry »

, ,

Leave a comment

How To Shuffle A Bash Array

Is there any way to shuffle the elements in a Bash array?

Absolutely, but you must write your own routine. Unlike other programming languages, such as Python, that contain dedicated shuffle methods, Bash does not have a built-in shuffle function of its own.

Here is one example of a custom shuffle script.

Read the rest of this entry »

, , , ,

Leave a comment

Mounting Truecrypt Volumes by Disk ID

Are you using scripts to mount your Truecrypt drives? Do the device paths seem to mix up randomly upon each system boot which confuses your scripts? Here is a technique to make sure each Truecrypt encrypted drive mounts in the correct mount point using disk identifiers to specify drives.
Read the rest of this entry »

, , , ,

1 Comment