01-18-2009
Special symbols in shell scripting
I am new to unix shell scripting, i was going through the existing shell scripts but couldn't able to get enough information on below syntaxes,i mean the symbols $# & $? used in the if loop. what exactly are they? what is the inline meaning, Could you please throw some light.
Examples:
1)
if [ $# -eq 3 ]
then
numFiles=`cat $3 | wc -l | sed 's/ //g'`
#echo $numFiles
count=0
2) if [ $? -eq 0 ]
then
echo "File $line moved to archive on `date +%D`">>$logFile
#echo $'\n' >>$logFile
else
echo "File $line can not be deleted">>$logFile
fi
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I'm currently working on a project that requires parsing xml file. One of the field in the xml is shown below (don't remember exactly):
<variable="ITEM">12345678</variable>
I coded my script keeping in mind that the value denoted in bold will always be a number. After getting just the... (1 Reply)
Discussion started by: mradul_kaushik
1 Replies
2. Shell Programming and Scripting
please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies
3. Shell Programming and Scripting
Hi,
I have file called suppliersList.txt
---------------------------------
112|MIMUS|krish@google.com
113|MIMIRE|krish@google.com
114|MIMCHN|krish@google.com
115|CEL|krish@google.com
108|UGEN|krishn@google.com
109|SLAND|krish@google.com
i have 3 varibale
-------------
no
Name... (4 Replies)
Discussion started by: kittusri9
4 Replies
4. Shell Programming and Scripting
Hi there,
Imagine we have to run a command in python shell from a perl script.
1 #!/usr/bin/perl
2 use strict;
3 my @con;
4 @con = `python`;
5 #?????print `print 'salaam'`;????
What's suitable situation for fifth line?
Thanks in advance. (4 Replies)
Discussion started by: Zaxon
4 Replies
5. Shell Programming and Scripting
Hi
How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Discussion started by: anupdas
2 Replies
6. What is on Your Mind?
Hi all,
I would like to start developping some good scripting skills. Do you think it would be best to start with shell scripting or Perl? I already got a fundation, really basics, in perl. but I am wondering what would be best to be good at first.
Can you please help me determine which one to... (14 Replies)
Discussion started by: Pouchie1
14 Replies
7. What is on Your Mind?
Gents,
I have been working in a Solaris/Unix environment for about 9 months. I took some linux classses online before getting the job. But, I am not very good at scripting. I want to learn how to script. Do you think that I should start with Shell scripting or Perl? I wanted to continue with... (2 Replies)
Discussion started by: Pouchie1
2 Replies
8. Web Development
i am going to study any one of the scripting languages mentioned above(shell 0r perl scripting) . Which is having more scope for a fresher? (1 Reply)
Discussion started by: Anna Hussie
1 Replies
9. UNIX for Dummies Questions & Answers
Can anybody help me figure this out? Thank you in advance.
I have a input file. It shows like this:
Query= random content
random content
> random content
random content
> random content
> random content
Query= random content
random content
random content
> random content
> random... (1 Reply)
Discussion started by: yuejian
1 Replies
10. Shell Programming and Scripting
Hi,
I need all your help to achieve the below functionality.
I have a big 2 GB file and inside the file we need to identify, whether having a comma(,) or pipe(|) or tab or fixed position or semicolon(;) delimiter. If any of those delimiter found need to replace the file with pipe(|)... (1 Reply)
Discussion started by: lkeswar
1 Replies
LEARN ABOUT DEBIAN
storebackupupdatebackup
STOREBACKUPUPDATEBACKUP(1) User Contributed Perl Documentation STOREBACKUPUPDATEBACKUP(1)
NAME
storeBackupUpdateBackup.pl - updates / finalizes backups created by storeBackup.pl with option --lateLink, --lateCompress
SYNOPSIS
storeBackupUpdateBackup.pl -b backupDirectory [--autorepair]
[--print] [--verbose] [--debug] [--lockFile] [--noCompress]
[--progressReport number] [--checkOnly]
[--logFile
[--suppressTime] [-m maxFilelen]
[[-n noOfOldFiles] | [--saveLogs]]
[--compressWith compressprog]]
storeBackupUpdateBackup.pl --interactive --backupDir topLevlDir
[--autorepair] [--print]
WARNING
!!! USAGE IN PARALLEL WITH storeBackup.pl CAN DESTROY YOUR BACKUPS !!!
OPTIONS
--interactive, -i
interactive mode for reparing / deleting currupted
backups created with option '--lateLinks'
--backupDir, -b
top level directory of all backups (must exist)
--autorepair, -a
repair simple inconsistencies automatically without
requesting the action
--print
print configuration read from configuration file and stop
--verbose, -v
verbose messages
--debug, -d
generate detailed information about the files
with the linking information in it
--lockFile, -L
lock file, if exist, new instances will finish if
an old is already running
If set to the same file as in storeBackup it will
prevent $prog from running in parallel
to storeBackup, default is $lockFile
--noCompress
maximal number of parallel compress operations,
default = chosen automatically
--checkOnly -c
do not perform any action, only check consistency
--progressReport
print progress report:
after each 'number' files when compressing
after each 'number * 1000' files when linking
after each 'number * 10000' files when performing chmod
--logFile, -l
logFile, Default: stdout
--suppressTime
suppress output of time in logfile
--maxFilelen, -m
maximal length of log file, default = 1e6
--noOfOldFiles, -n
number of old log files, default = 5
--saveLogs
save log files with date and time instead of deleting the
old (with [-noOldFiles])
--compressWith
compress saved log files (e.g. with 'gzip -9').
default is 'bzip2'
COPYRIGHT
Copyright (c) 2008,2012 by Heinz-Josef Claes. Published under the GNU General Public License v3 or any later version
perl v5.14.2 2012-06-16 STOREBACKUPUPDATEBACKUP(1)