Sponsored Content
Full Discussion: argument count
Top Forums Shell Programming and Scripting argument count Post 302348841 by cfajohnson on Sunday 30th of August 2009 03:08:10 AM
Old 08-30-2009
Quote:
Originally Posted by KenJackson
Are you saying that the syntax of [!...] as described in the Filename Expansion section of the Bash manual is not POSIX and not portable?
Or do you just mean that Bash in general is not POSIX and not portable?

Oh! I just found a document from the OpenGroup that describes Pattern Matching Notation which says, A bracket expression starting with an unquoted <circumflex> character produces unspecified results. Great! A built-in gotcha.

If you use non-standard syntax, you should expect to have problems.
Quote:
It is true that Bash has extensions beyond POSIX, and therefore if something works perfectly in the Bash shell, there is no guarantee it will work in some other shell. For that reason there is wisdom in insisting on POSIX compatibility as you do.

Absolutely.
Quote:
But one has to consider the context in which one codes. Many scripts will never be used outside of Bash, or even be seen by someone who holds Bash extensions in other than the highest regard. If one writes a Perl or Python script, it's not wrong to require that it only be run on systems with Perl or Python installed. I don't think it's out of order to view Bash scripts similarly.

There is a major difference between a shell and perl or python. A shell is a necessary component of a system; perl and python are not.

When I write a script, I try to write it using a portable (i.e. POSIX) syntax. If writing for bash, I may use bash extensions, but I never use bash-only syntax for something that can be coded with POSIX syntax.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to find the last argument in a argument line?

How to find the last argument in a argument line? (4 Replies)
Discussion started by: nehagupta2008
4 Replies

2. Shell Programming and Scripting

get positive number n as argument script must calculate the factorial of its argument

Can someone please help me with this SHELL script? I need to create a script that gets a positive number n as an argument. The script must calculate the factorial of its argument. In other words, it must calculate n!=1x2x3x...xn. Note that 0!=1. Here is a start but I have no clue how to... (3 Replies)
Discussion started by: I-1
3 Replies

3. Shell Programming and Scripting

bad argument count, tryig to FTP

I have a file in a Unix directory called 97210900.EFT I am getting this error: miis_ftp.ELM_EFT.shl: cd: bad argument count + + type=1 + ErrorHandle Here is the piece of code that is checking the file # Change the directory to one contains the file to be transported ##cd... (1 Reply)
Discussion started by: rechever
1 Replies

4. Shell Programming and Scripting

count identical strings print last row and count

I have a sorted file like: Apple 3 Apple 5 Apple 8 Banana 2 Banana 3 Grape 31 Orange 7 Orange 13 I'd like to search $1 and if $1 is not the same as $1 in the previous row print that row and print the number of times $1 was found. so the output would look like: Apple 8 3 Banana... (2 Replies)
Discussion started by: dcfargo
2 Replies

5. Shell Programming and Scripting

Cannot compare argument in if statement in csh/grep command if argument starts with “-“

If ($argv == “-debug”) then Echo “in loop” Endif But this is not working. If I modify this code and remove “-“, then it works. Similarly I am getting problem using grep command also Grep “-debug” Filename Can someone please help me on how to resolve these... (1 Reply)
Discussion started by: sarbjit
1 Replies

6. Shell Programming and Scripting

Make script that run with argument if not run from configuration file argument

Hello, Is there any method thorugh which script can take argument if pass otherwise if argument doesn't pass then it takes the argument from the configuration file i.e I am workiing on a script which will run through crontab and the script will chekout the code ,zip and copy to the... (3 Replies)
Discussion started by: rohit22hamirpur
3 Replies

7. UNIX for Advanced & Expert Users

Error:--test: argument expected--Even though i give an argument.

Hi All, I am running the script VBoxManage list vms |sed 's/"//g' | cut -d " " -f1 > har1out.mytxt result=`cat har1out.mytxt | grep $1' echo $result echo $1 { if then echo pass else echo fail fi (2 Replies)
Discussion started by: harsha85
2 Replies

8. Shell Programming and Scripting

kill: bad argument count

Hi Team, I am getting the below error when running the script. Please let me know how to solve this error. start_WFA.sh: kill: bad argument count Below is the Script: #!/bin/ksh kill -9 `ps -ef|grep classpath |grep "/apps/ap" |grep -v "Xmx" |grep $LOGNAME |awk '{print $2}'` Thanks, (6 Replies)
Discussion started by: Mukharam Khan
6 Replies

9. Shell Programming and Scripting

Compare file1 header count with file2 line count

What I'm trying to accomplish. I receive a Header and Detail file for daily processing. The detail file comes first which holds data, the header is a receipt of the detail file and has the detail files record count. Before processing the detail file I would like to put a wrapper around another... (4 Replies)
Discussion started by: pone2332
4 Replies

10. UNIX for Beginners Questions & Answers

How to find the count of IP addresses that belong to different subnets and display the count?

Hi, I have a file with a list of bunch of IP addresses from different VLAN's . I am trying to find the list the number of each vlan occurence in the output Here is how my file looks like 1.1.1.1 1.1.1.2 1.1.1.3 1.1.2.1 1.1.2.2 1.1.3.1 1.1.3.2 1.1.3.3 1.1.3.4 So what I am trying... (2 Replies)
Discussion started by: new2prog
2 Replies
GSMPB(8)						      System Manager's Manual							  GSMPB(8)

NAME
gsmpb - GSM mobile phone phonebook manipulation program SYNOPSIS
gsmpb [ -b baudrate ] [ --baudrate baudrate ] [ -c ] [ --copy ] [ -d destination device or file ] [ --destination destination device or file ] [ -h ] [ --help ] [ -i ] [ --index ] [ -I init string ] [ --init init string ] [ -p phonebook name ] [ --phonebook phonebook name ] [ -s source device or file ] [ --source source device or file ] [ -t character set ] [ --charset character set ] [ -v ] [ --version ] [ -V ] [ --verbose ] [ -X ] [ --xonxoff ] [ -y ] [ --synchronize ] DESCRIPTION
gsmpb can store or retrieve phonebook entries residing in a GSM mobile phone's phonebook to or from a file. A synchronization mode is also available. gsmpb reads entries from the source which can be a mobile phone (if a serial device file is given) or a file (if a file name is given). The source is never modified. gsmpb writes phonebook entries to a destination file or device. Depending on the mode the source is copied to the destination file, thus overwriting the destination, or the destination is synchronized with regard to the source which is the default (details see below). If "-" is given as the parameter for the --source or --destination options, the phonebook is read from standard input and/or written to standard output, respectively. Phonebook entries names are encoded using the GSM default alphabet in the mobile phone, whereas they are stored using the Latin-1 encoding in phonebook files. When reading phonebook entries from a mobile phone entry names are converted from the GSM default to Latin-1. Charac- ters that can not be converted to Latin-1 are encoded as character code 172 (Latin-1 boolean "not"). When writing file-based phonebook entries to a mobile phone a conversion to the GSM default alphabet takes place. Characters that can not be converted are encoded as GSM delta (code 16). If the default character set has been changed using the --charset option no conversion takes place. Error messages are printed to the standard error output. If the program terminates on error the error code 1 is returned. OPTIONS
-b baudrate, --baudrate baudrate The baud rate to use. The default baudrate is 38400. -c, --copy This causes the contents of the source to be copied to the destination. After this operation the destination has exactly the same contents as the source. -d destination, --destination destination The destination device or file. -h, --help Prints an option summary. -I init string, --init init string Initialization string to send to the TA (default: "E0"). Note that the sequence "ATZ" is sent first. -i, --index If the index position is given, gsmpb preserves the assignment of entries to memory slots in the mobile phone's phonebook. This can be used to backup phonebook entries with their position into a phonebook file or to change the position of entries by editing a phonebook file and writing them back to the mobile phone. If this option is given the phonebook file used as the source must con- tain indices for every entry. Additionally, these indices must be unique, ie. it is not allowed to assign one entry twice to a spe- cific position in the mobile phone's phonebook. -p phonebook, --phonebook phonebook The name of the phonebook to read from or write to. This is only used for device sources and destinations. Commonly available phone- books are: FD SIM fixdialling-phonebook LD SIM last-dialling-phonebook ME ME phonebook MT combined ME and SIM phonebook SM SIM phonebook TA TA phonebook -s source, --source source The source device or file. -t character set, --charset character set Set the character set to use for phonebook operations (default is the GSM default alphabet). -v, --version Prints the program version. -V, --verbose Prints out a detailed progress report. -X, --xonxoff Uses software handshaking (XON/XOFF) for accessing the device. -y, --synchronize This causes the contents of the source to be synchronized with the destination (default). Synchronization in this con- text means: - If the source contains an entry with a name that does not exist in the destination this entry is added to the desti- nation. - If the source contains an entry with a name that can also be found in the destination, the entry in the destination is overwritten (ie. the telephone number is updated). Exception: More then one entry with the name exists in the destination. In this case the new entry ist just added. - Entries in the destination that do not exist in the source are deleted. Note that synchronization has the following properties that differ from copying: This algorithm does not change the location of unchanged entries in the destination phonebook. The synchronization function is not case-sensitive when comparing names. PHONEBOOK FILE FORMAT
Phonebook entries are stored in phonebook files that are meant to be human-readable and -editable. There is one phonebook entry per line, and each line has the format: index|text|phone number The fields have the following meanings: index The index of the entry which must be a positive number. The index may also be empty. Indices can be used in conjunction with the --index option to store the entry into a specific position in the mobile phone. text Descriptive text for the entry. The text may con- tain the special characters '', '|', carriage return (ASCII code 13), or line feed (ASCII code 10). These must be written "\", "|", " ", " ", respectively. The text should only contain charac- ters that can be encoded using the GSM default alphabet (see comments above). phone number Phone numbers can only contains the digits 0-9 and the '+' sign. A '+' sign denotes an international number. EXAMPLES
The following invocation of gsmpb synchronizes the mobile phone's SIM phonebook with the file $HOME/.phonebook: gsmpb --synchronize -b 19200 -d /dev/mobilephone -s $HOME/.phonebook -p "SM" AUTHOR
Peter Hofmann <software@pxh.de> BUGS
Report bugs to software@pxh.de. Include a complete, self- contained example that will allow the bug to be repro- duced, and say which version of gsmpb you are using. COPYRIGHT
Copyright (C) 1999 Peter Hofmann gsmpb is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Pub- lic License as published by the Free Software Foundation; either version 2, or (at your option) any later version. gsmpb is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied war- ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR- POSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with gsmpb; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. SEE ALSO
gsminfo(7), gsmctl(1), gsmsendsms(1), gsmsmsd(8), gsmsms- store(1). gsmpb v1.10 Sat Jun 16 22:10:00 UTC 2012 GSMPB(8)
All times are GMT -4. The time now is 03:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy