[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] arrays (was: bash og sed



On Mon, 26 Jul 2004, Torben Andersen wrote:

> Jeg er ved for sjov at lave et script i bash

Jep, det er sjovt.

> svcdfilm og vil selv lade det bestemme antallet af .mpg filer og lægge 
> filnavnene over i et array. Jeg har rodet rundt efter information og 
> forestiller mig noget med "ls -1", "sed" og et variabel array til 

Prøv at start her og se om det hjælper på vej:
http://www.linuxbog.dk/unix/unix/shell-script.html

Jeg har prøvet at rode lidt med arrays, men har ikke rigtigt fået 
skrevet noget om det. Inden du spørger, ja så har jeg lavet et rodet 
script der gør lidt af hvert, men du selv finde ud af hvad det gør:

#! /bin/sh

ARR=(hej dav)
ARR=(${ARR[*]} du)

echo "'${ARR[0]}' har ${#ARR[0]} tegn"
echo ${ARR[*]}
N=0
for T in ${ARR[*]};do
        echo "X $N ${#ARR[*]} $T X"
        let N=N+1
done


NAVNE=("Tyge Brahe" "Otto Brahe")
EMAILS=(sslug@sslug sslug@sslug)
N=0
while ((N< ${#NAVNE[*]}))
do
        echo "$N '${NAVNE[$N]}' <${EMAILS[$N]}>"
        let N=N+1
done

for T in sslug@sslug
do
        echo "-- $T"
done
for T in ${NAVNE[*]}
do
        echo "++ $T"
done

IFS="|"
A="$(echo "${NAVNE[*]}" | sed 's/|/" "/')"
echo "\"$A\""
# EndOfFile

/hans
-- 
Hamletsgade 4 - 201, DK-2200 København N, Phone: +45 3582 9079
Schou Industries ApS      http://schou.dk/    CVR: 26 13 44 39
--------------------------------------------------------------
"Why would you hand...our IP to America gift-wrapped, without
any return?"		-- Andrew Tridgell, software patents


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *