Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
4Activity
0 of .
Results for:
No results containing your search query
P. 1
Shell Script Appendix

Shell Script Appendix

Ratings: (0)|Views: 69 |Likes:
Published by batlinm
shell script appendix
shell script appendix

More info:

Published by: batlinm on Sep 20, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

03/21/2013

pdf

text

original

 
1
Simple Shell Scriptingfor Scientists
Bruce BecklesUniversity of Cambridge Computing Service
Appendix
 
2
escience-support@ucs.cam.ac.ukSimple Shell Scripting for Scientists: Appendix2
Common Unix commands
The following slides provide asummary of the Unix commandsused in the “Simple ShellScripting for Scientists” course.
For details of the “Unix: Simple Shell Scripting for Scientists”course,see:
http://www.cam.ac.uk/cs/courses/coursedesc/scicomp.html#scriptsci
 
3
escience-support@ucs.cam.ac.ukSimple Shell Scripting for Scientists: Appendix3
Appendix: Unix commands (1)
basename
return the filename from a filepath, removing the givenending (if specified)
>
basename /usr/bin/python
python>
 basename ~/hello.sh .sh
hellodirname
return the
dir 
ectory
name
from a file path
>
dirname /usr/bin/python
/usr/bin
If you have a path to a file,
dirname
will give you just the directory, removingthe actual filename whilst
basename
will give you the filename, removing thedirectory path.
basename
can also remove the endings of filenames.If you need to do more advanced filename (or file) manipulation,then youshould look at the
find
and
xargs
commands, which are covered in the “UnixSystems: Further Commands” course, the notes for which are available here:http://www-uxsup.csx.cam.ac.uk/courses/Commands/The
find
command searches for files in a directory tree, and having found thespecified files, can run a command on each file.The
xargs
command builds a command line from a combination of valuesread from standard input and arguments specified on the command line, andthen executes that command line a certain number of times.

Activity (4)

You've already reviewed this. Edit your review.
1 hundred reads
irukulapati liked this
Sanjay liked this
PJB liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->