Example in Pro Bash Programming book problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Example in Pro Bash Programming book problem
# 1  
Old 01-17-2011
Example in Pro Bash Programming book problem

I am going through the examples in the book "Pro Bash Programing" which is quite a good book on bash programing. Just a word of warning about the example script called sa that simply shows command line arguments. In CentOS 5.5 there is a program called sa already on the system. Boy did that throw me off for awhile. Everything works using the dot slash ./sa {1..10} but bombs when using just sa {1..10}. It took me a half hour scratching my head why this wasn't working when everything was working fine the previous half hour.

Code:
#!/bin/bash
## script name: sa
## Purpose: Displaying Command-Line Arguments
pre=:
post=:
printf "$pre%s$post\n" $@

Error that I was getting:
$ sa {1,2,3}
sa: extra arguments `1', `2', `3' -- aborting

Correct output example:
Code:
 
$ ./sa {1,2,3}
:1:
:2:
:3:

So does anybody know what the redhat sa command is for? I looked at the man page but can't make any sense out of it. Running it doesn't create any output to the screen.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Programming book should every programmer read?

hi, i want some advice on a programming book should every programmer read? (2 Replies)
Discussion started by: kaja
2 Replies

2. Shell Programming and Scripting

any good book for shell programming and scripting??

as title suggest i am looking for good book to start learning shell programming.please help me with this. (5 Replies)
Discussion started by: pvk21
5 Replies

3. Programming

Building Block style programming Book

Hello to all, Here is my situation. Some time in the mid-80's I stumbled across a small white programming book - can't remember the name but it was unique in that it started right out giving instructions on creating building blocks in code as a foundation for a complete system. The book was... (2 Replies)
Discussion started by: jozefn
2 Replies

4. Programming

Unix System Programming Book

Hi, I've almost finished "Advanced Linux Programming" book. However, I feel as if I need dig deeper in IPC specially socket programming as well as multi-threading. Can anyone recommend a good book (preferably publically available)? (5 Replies)
Discussion started by: jaywalker
5 Replies

5. Shell Programming and Scripting

Which Book to refere 4 shell programming

Hi frnds i'm new to programming in shell, i just started to study in net but i want some book to refere , so any one pls tell me which books i can refere pls rate the book like for begining , user level , then for pandith or to become pandith level....... (3 Replies)
Discussion started by: ~monu~
3 Replies

6. Programming

System programming book

please tell me the best book for Unix's System programming..... so that i become expert in System programming.I have completed shell programming and i know C programming in Unix. please tell me which book i should prefer... -ajit (1 Reply)
Discussion started by: ajit_gupta
1 Replies

7. Shell Programming and Scripting

KORN SHELL PROGRAMMING BY EXAMPLE book

Hi all, can any tell if we can get Indian edition of korn shell programming by example by O'brain from QUE publications. I tried to and did not find. If any one is having the infi then pls let me know. thanks in advance. ksrsarma (0 Replies)
Discussion started by: ksrsarma
0 Replies

8. Programming

Unix Programming Book Comparison

Hi, I am starting out to program on Unix, having had experience in C and C++ in DOS. I would like to know, of these three, which is the best book for learning C programming in Unix: Advanced Unix Programming by Marc Rochkind Advanced Unix Programming by Warren Gay Advanced Programming in... (6 Replies)
Discussion started by: theicarusagenda
6 Replies

9. Programming

book to learn pro c\c++

can any one help me and told me about a good books to learn 1- pro c/c++ under unix 2- programming network using c under unix thnx in advance. (1 Reply)
Discussion started by: kazanoova2
1 Replies

10. UNIX for Dummies Questions & Answers

domain logon problem - FreeBSD PDC w/ win2k pro and winxp pro

this is the seventh problem i'm having with samba. for some reason, i cannot logon to the domain. i've created user accounts... and i was able to establish a connection between the samba server (my PDC) and my workstations by logging in as "root." however now when i try to logon it gives... (5 Replies)
Discussion started by: xyyz
5 Replies
Login or Register to Ask a Question