11.04.2013 Views

Guida avanzata di scripting Bash - Portale Posta DMI

Guida avanzata di scripting Bash - Portale Posta DMI

Guida avanzata di scripting Bash - Portale Posta DMI

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

string1=two<br />

echo<br />

echo "Testing \"strcat\" function:"<br />

echo "Original \"string0\" = $string0"<br />

echo "\"string1\" = $string1"<br />

strcat string0 string1<br />

echo "New \"string0\" = $string0"<br />

echo<br />

# strlen<br />

echo<br />

echo "Testing \"strlen\" function:"<br />

str=123456789<br />

echo "\"str\" = $str"<br />

echo -n "Length of \"str\" = "<br />

strlen str<br />

echo<br />

# Exercise:<br />

# --------<br />

# Add code to test all the other string functions above.<br />

exit 0<br />

Appen<strong>di</strong>ce A. Script aggiuntivi<br />

Esempio <strong>di</strong> array complesso, <strong>di</strong> Michael Zick, che utilizza il comando md5sum per co<strong>di</strong>ficare<br />

informazioni sulle <strong>di</strong>rectory.<br />

Esempio A-19. Informazioni sulle <strong>di</strong>rectory<br />

#! /bin/bash<br />

# <strong>di</strong>rectory-info.sh<br />

# Parses and lists <strong>di</strong>rectory information.<br />

# NOTE: Change lines 273 and 353 per "README" file.<br />

# Michael Zick is the author of this script.<br />

# Used here with his permission.<br />

# Controls<br />

# If overridden by command arguments, they must be in the order:<br />

# Arg1: "Descriptor Directory"<br />

# Arg2: "Exclude Paths"<br />

# Arg3: "Exclude Directories"<br />

#<br />

# Environment Settings override Defaults.<br />

# Command arguments override Environment Settings.<br />

# Default location for content addressed file descriptors.<br />

MD5UCFS=${1:-${MD5UCFS:-’/tmpfs/ucfs’}}<br />

644

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!