bash

How to use ftp in a shell script

(via www.stratigery.com)

Sometimes I want to FTP a file from one machine to another. Usually, I can do the transfer interactively, but every so often, I would like to have a shell script do the file transfer. This task has eluded me in the past, but I finally figured it out. I've not seen this particular trick documented in the past, so I submit it for your approval...

The best tips & tricks for bash, explained

(via www.linuxtutorialblog.com)

The bash shell is just amazing. There are so many tasks that can be simplified using its handy features. This tutorial tells about some of those features, explains what exactly they do and learns you how to use them.

Small getopts tutorial

(via wiki.bash-hackers.org)

When you want to parse commandline arguments in a professional way, getopts is the tool of choice. Unlike its older brother getopt (note the missing s!), it's a shell builtin command. The advantage is

* you don't need to hand your positional parameters through to an external program
* getopts can easily set shell variables you can use for parsing (impossible for an external process!)
* you don't have to argue with several getopt implementations which had buggy concepts in the past (whitespaces, ...)
* getopts is defined in POSIX®

Bash Tests

(via mywiki.wooledge.org)

The test application, also known as [, is an application that usually resides somewhere in /usr/bin or /bin and is used a lot by shell programmers to perform certain tests on variables. In a number of shells, including bash, [ is implemented as a shell builtin.

Difference between test, "[" and "[[":
http://mywiki.wooledge.org/BashFAQ/031

network programming in bash

(via shudder.daemonette.org)

Discusses the possibilities of using Bash for socket programming using /dev/tcp with file descriptors redirection.

Linux Command Line Reference

(via www.pixelbeat.org)

Linux command line reference for common operations...

vim BASH IDE

(via www.vim.org)

Write BASH-scripts by inserting comments, statements, tests, variables, builtins, etc..
Speed up writing new scripts considerably. Write code and comments with a professional appearance from the beginning....

Bash Comparison Operators

(via tldp.org)

Very helpful when unsure on using the type of comparison operators and brackets to use in bash.

Writing Robust Shell Scripts

(via www.davidpashley.com)

Many people hack together shell scripts quickly to do simple tasks, but these soon take on a life of their own. Unfortunately shell scripts are full of subtle effects which result in scripts failing in unusual ways. It's possible to write scripts which minimise these problems. In this article, I explain several techniques for writing robust bash scripts...

Variable Mangling in Bash with String Operators

(via www.linuxjournal.com)

Have you ever wanted to change the names of many files at once? Or, have you ever needed to use a default value for a variable that has no value? These and many other options are available to you when you use string operators in bash and other Bourne-derived shells...

Comment