03-03-2009
Use basename
Hi Snail,
This is quite easy in Unix, just use "basename" command.
# basename abc.txt .txt
will give you the base name of the abc.txt.
# mkdir `basename abc.txt .txt`
will do pretty much what you want.
# man basename
also helps
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
helo i make one process for com port . in that i create two thread one for reading data and another for writing data to com port.
now i want to write a script which create 30 processes for handling 30 com port.
is it good solution for handling 30 com port.
Thx & Regards,
Amit (2 Replies)
Discussion started by: amitpansuria
2 Replies
2. Shell Programming and Scripting
hello.
i hav accepted name of directory from user through a form.now i need to create a directory under cgi-bin of that name.I am not able to do so.n help is required (12 Replies)
Discussion started by: raksha.s
12 Replies
3. Shell Programming and Scripting
Hi Guru's,
I have to write a shell script which groups file names based upon the certain matching string pattern, then creates the Tar file for that particular group of files and then zips the Tar file created for the respective group of files.
For example, In the given directory these files... (3 Replies)
Discussion started by: rahu_sg
3 Replies
4. UNIX for Dummies Questions & Answers
Hello,
I'm a newbie in shell script.
So, i would like to create a shell script which take 2 IN parameters (PARAM1 and PARAM2).
This script need to create 2 files as :
I need to create this file /etc/apache2/sites-available/PARAM2 :
<VirtualHost *:80>
DocumentRoot "/home/PARAM1/www"... (0 Replies)
Discussion started by: chatlumo
0 Replies
5. Shell Programming and Scripting
Hi there,
pleas I want this script urgently. how to lock a directory by shell script? (12 Replies)
Discussion started by: joneggk
12 Replies
6. Shell Programming and Scripting
I have a working script that defines the paths using variables which is used to move a rename files that are being archived. Is there a way to create a directory in the path with the date as the name and then reference it when moving the file to it?
Here is what I have tried with no luck....
... (1 Reply)
Discussion started by: Snickyt0310
1 Replies
7. Homework & Coursework Questions
first off let me introduce myself. My name is Eric and I am new to linux, I am taking an advanced linux administration class and we are tasked with creating a script to add new users that anyone can run, has to check for the existence of a directory. if the directory does not exist then it has... (12 Replies)
Discussion started by: pbhound
12 Replies
8. Shell Programming and Scripting
Hi,
I need help in debug following script. can somebody help....!!!
#!/usr/bin/perl -w
use strict;
use Spreadsheet::WriteExcel;
# Create a new workbook called simple.xls and add a worksheet.
my $workbook = Spreadsheet::WriteExcel->new('simple.xls');
my $worksheet =... (1 Reply)
Discussion started by: chettyravi
1 Replies
9. Shell Programming and Scripting
I have a directory that has files going into it and moving out on a regular basis. The normal state of the directory would be to be empty. I need to write a script that will check to see if files are Not moving out of the directory. Any help would be most welcome. (4 Replies)
Discussion started by: RoBKoS
4 Replies
10. Shell Programming and Scripting
I have a script, which is checking if file exists and move it to another directory
if
then
mkdir -p ${LOCL_FILES_DIR}/cool_${Today}/monthly
mv report_manual_alloc_rpt_A_I_ASSIGNMENT.${Today}*.csv ${LOCL_FILES_DIR}/cool_${Today}/monthly
... (9 Replies)
Discussion started by: digioleg54
9 Replies
SHAR(1) BSD General Commands Manual SHAR(1)
NAME
shar -- create a shell archive of files
SYNOPSIS
shar file ...
DESCRIPTION
shar writes an sh(1) shell script to the standard output which will recreate the file hierarchy specified by the command line operands.
Directories will be recreated and must be specified before the files they contain (the find(1) utility does this correctly).
shar is normally used for distributing files by ftp(1) or mail(1).
SEE ALSO
compress(1), mail(1), tar(1), uuencode(1)
BUGS
shar makes no provisions for special types of files or files containing magic characters.
EXAMPLES
To create a shell archive of the program ls(1) and mail it to Rick:
cd ls
shar `find . -print` | mail -s "ls source" rick
To recreate the program directory:
mkdir ls
cd ls
...
<delete header lines and examine mailed archive>
...
sh archive
HISTORY
The shar command appears in 4.4BSD.
SECURITY CONSIDERATIONS
It is easy to insert trojan horses into shar files. It is strongly recommended that all shell archive files be examined before running them
through sh(1). Archives produced using this implementation of shar may be easily examined with the command:
egrep -v '^[X#]' shar.file
4.4BSD June 6, 1993 4.4BSD