03-11-2010
Hi amit,
What does this mean
fixpart="/etc/usr/transfer_script # transferring to a system"
There is a "#" before a string and the entire file path and the string are in a quote.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello Friends,
I am new to the scripting & have to analyze bunch of regular production scripts. It has .ksh which calls on the .awk script having many functions
I need to understand and debug the scripts ASAP
Can anybody please let me know as how can I debug, I want to see the flow of code... (3 Replies)
Discussion started by: amberj123
3 Replies
2. Shell Programming and Scripting
#! /usr/bin/ksh
old=$1
new=$2
for file in *.$old ; do
mv $file ${file%$old}$new
done
exit 0
This script i got from the forum. script changes the extension of the files say example
a.txt to a.doc
b.txt to b.doc
c.txt to c.doc
d.txt to d.doc
this scipt works fine but i am not... (2 Replies)
Discussion started by: vijays3
2 Replies
3. Shell Programming and Scripting
Need a better understanding of shell scripts (14 Replies)
Discussion started by: sureshkumar4737
14 Replies
4. Shell Programming and Scripting
Can someone explain what is happening line by line in this script, particularly after the do statement. The script works, it renames all the files in my directory that has a date in the file name. But I would like to know more about it.
#!/bin/bash
newdate=12-10-1995
for file in *--*
do
... (6 Replies)
Discussion started by: Harleyrci
6 Replies
5. Shell Programming and Scripting
Hi
I have wrote the small script, where $SRC=$HOME
the input file is simple text file having directories in my $SRC on pre line
desktop
download
myfiles
games
#!/bin/bash
FILENAME=$1
ERROR_LOG="$SRC/err.$$.log"
while read line
do
echo "########## strat Gmake $line... (6 Replies)
Discussion started by: the.reverser
6 Replies
6. Shell Programming and Scripting
Can Anybody please tell me the meaning of the script:
#!/bin/sh
str=$@
echo $str | sed 's/.*\\//'
exit 0 (6 Replies)
Discussion started by: nixhead
6 Replies
7. Shell Programming and Scripting
Hi Gurus,
Im new to Shell scripting. I have a shell script which basically sends an email when called thorugh my ETL tool. Wanted to understand the its functionality in detail. Would be great it any one can explain what exactly the commands to
#!/bin/sh
# Dummy UUCP rmail command for... (1 Reply)
Discussion started by: r_t_1601
1 Replies
8. Shell Programming and Scripting
Am still learning Scripting and I come across a build command that I don't really understand
if /local/bin/wsname 2>/dev/null; then
base="`/local/bin/wsname`"
export base
fi
if ; then
/local/bin/wsname
exit 1
fi
WSNAME="$base"/
can some one in light me to what... (1 Reply)
Discussion started by: Wpgn
1 Replies
9. Shell Programming and Scripting
Could someone please help me in understanding the code below:
#!/usr/bin/ksh
Month=`date|cut -c5-7`
Day=`date|cut -c9-10`
Year=`date|cut -c27-28`
Rom2Jul() { case $Month in Feb) Day=$(( $Day+31 ));;
Mar) Day=$((... (27 Replies)
Discussion started by: hasn318
27 Replies
10. UNIX for Beginners Questions & Answers
Below script is called as Reducer, I am not sure how it work, can some expert explain me what this script does as i am a beginner.
inputfile:
hi hi how are are you
code:
#!/bin/bash
lastkey=""; -- what does this mean, because i saw in debug mode it is taking value as hi
count=0;... (13 Replies)
Discussion started by: mirwasim
13 Replies
LEARN ABOUT REDHAT
dirname
DIRNAME(3) Linux Programmer's Manual DIRNAME(3)
NAME
dirname, basename - Parse pathname components
SYNOPSIS
#include <libgen.h>
char *dirname(char *path);
char *basename(char *path);
DESCRIPTION
The functions dirname and basename break a null-terminated pathname string into directory and filename components. In the usual case,
dirname returns the string up to, but not including, the final '/', and basename returns the component following the final '/'. Trailing
'/' characters are not counted as part of the pathname.
If path does not contain a slash, dirname returns the string "." while basename returns a copy of path. If path is the string "/", then
both dirname and basename return the string "/". If path is a NULL pointer or points to an empty string, then both dirname and basename
return the string ".".
Concatenating the string returned by dirname, a "/", and the string returned by basename yields a complete pathname.
Both dirname and basename may modify the contents of path, so if you need to preserve the pathname string, copies should be passed to these
functions. Furthermore, dirname and basename may return pointers to statically allocated memory which may be overwritten by subsequent
calls.
The following list of examples (taken from SUSv2) shows the strings returned by dirname and basename for different paths:
path dirname basename
"/usr/lib" "/usr" "lib"
"/usr/" "/" "usr"
"usr" "." "usr"
"/" "/" "/"
"." "." "."
".." "." ".."
EXAMPLE
char *dirc, *basec, *bname, *dname;
char *path = "/etc/passwd";
dirc = strdup(path);
basec = strdup(path);
dname = dirname(dirc);
bname = basename(basec);
printf("dirname=%s, basename=%s
", dname, bname);
free(dirc);
free(basec);
RETURN VALUE
Both dirname and basename return pointers to null-terminated strings.
BUGS
In versions of glibc up to and including 2.2.1, dirname does not correctly handle pathnames with trailing '/' characters, and generates a
segmentation violation if given a NULL argument.
CONFORMING TO
SUSv2
SEE ALSO
dirname(1), basename(1),
GNU
2000-12-14 DIRNAME(3)