namelist

This is a simple little script to make a list of N name, where each name is the line number:


% namelist
Usage: namelist 10 
arg1 - number of lines named in the list to standard out  

% namelist 8 
1
2
3
4
5
6
7
8


% namelist 8 > My_List 
% cat My_List 
1
2
3
4
5
6
7
8
 

Becasue I always seem to forget how to do this, here is the code:


#!/bin/bash
# make a list f N names, where the anem is the line number 

# Check command line arguments 
if [ -z "$1" ]
then
    printf "Usage: namelist 10 \n"
    printf "arg1 - number of lines named in the list to standard out  \n"
    exit
fi

num="$1" 
#printf "Number of names will be = $num\n" 

x=1
while [ $x -le $num ]
do
# echo "Welcome $x times"
 printf "$x\n"
  x=$(( $x + 1 ))
done

 




Back to SCO CODES page