devexpress asp.net mvc pdf viewer : Copy pdf pages to another pdf software control cloud windows azure web page class AppleShellScripting-201415-part637

DiskManagementandPartitioning
DiskmanagementandpartitioningtoolsvarywidelyfromoneUNIX-basedorUNIX-likeOStothenext.Itis
impracticalforthisdocumenttocoverthesubjectindepth.
ForinformationonotherUNIX-basedandUNIX-likeoperatingsystems,agoodplacetostartistheUNIXSystem
AdministrationHandbookbyNemethandothers.
ForinformationaboutOSXcommand-linetoolsfordiskmanagementandpartitioning,readIntroductionto
Command-LineAdministrationathttp://manuals.info.apple.com/en_US/IntroCommandLine_v10.6.pdf,and
seesection8ofOSXManPages.Inparticular,youshouldlookatthemanpagesfor
hdiutil
,
pdisk
,
fdisk
,
gpt
,and
diskutil
.
GeneralCommand-LineToolDifferences
Anumberofcommand-linetoolsbehavedifferentlyacrossvariousUNIX-basedandUNIX-likeoperatingsystems.
Thischapterexplainssomeofthekeydifferencesinthosetools.
UNIX-basedandUNIX-likeoperatingsystemsgenerallyfallintooneofthreecamps:
AT&TUNIX:AlsoknownasUNIXSystemV(initslatestincarnation),AT&TUNIXwastheoriginalUNIX
operatingsystem.ItsdescendantsincludemostoperatingsystemsthatarecommonlyreferredtoasUNIX.
BSD:ShortforBerkeleySoftwareDistribution,BSDisthenamegiventoafamilyofoperatingsystems
descendedfromaderivativeofUNIXthatwasoriginallydistributedbytheUniversityofCalifornia,Berkeley,
inthe1970s.
Overtheyears,theBerkeleydistributionandtheAT&Tdistributioncontinuedtodiverge.Theresultisthat
thereareanumberofsubtlesyntaxdifferencesbetweenshellscriptswrittenforsystemsthatfollowAT&T
semanticsversusthosethatfollowBSDsemantics.
Inthe1990s,BSDi(acommercialcompanyformedasaresultoftheUCBerkeleyresearch)releasedthe
BSDoperatingsystemasopensource.MostmodernBSDoperatingsystemsarederivedfromthissource
base,knownas4.4BSD-Literelease2.
BecauseoflicensingrestrictionsontheoriginalUNIXsourcecode,theportionsthatwereoriginallywritten
byAT&Thadtoberewrittenunderamorepermissivelicenseinordertoreleaseitasopensource.This
contributedfurthertothedifferencesinsyntaxbetweenBSD-basedandAT&TUNIX-basedoperating
systems.
LinuxandGNU:Duringthe1990s,anewoperatingsystem,Linux,wasborn.Combiningakernelwritten
byLinusTorvaldsandanumberofutilitieswrittenbytheFreeSoftwareFoundation(FSF)fortheirown
operatingsystemproject(GNUHurd),thisoperatingsystemquicklygrewintoaveryimportantthird
UNIX-likeoperatingsystem.
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
151
Copy pdf pages to another pdf - control SDK platform:C# PDF Page Extract Library: copy, paste, cut PDF pages in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Easy to Use C# Code to Extract PDF Pages, Copy Pages from One PDF File and Paste into Others
www.rasteredge.com
Copy pdf pages to another pdf - control SDK platform:VB.NET PDF Page Extract Library: copy, paste, cut PDF pages in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Detailed VB.NET Guide for Extracting Pages from Microsoft PDF Doc
www.rasteredge.com
AddingtotheimportanceofLinuxandtheGNUtoolswastheadventofMacBSD,FreeBSD,NetBSD,
OpenBSD,andotherBSDvariants.AlthoughBSD-basedoperatingsystemshadmanycommonutilities,
theyhadnoreplacementsforafewofthemissingAT&Tpieces.Forthisreason,manyofthesetoolshave
alsomadetheirwayintotheseBSD-basedoperatingsystems.Inasimilarway,BSD-derivedtoolsfrequently
appearaspartofLinuxdistributions.
Overtheyears,anumberofstandardshaveemergedtomitigatethedifferencesinsyntaxbetweenthese
operatingsystems,includingPOSIXandtheSingleUnixSpecification(SUS).Asoperatingsystemsworktowards
compliancewiththesespecifications,manyofthedifferencesinsyntaxaregraduallyfadingintoirrelevance.
However,fortruecross-platformcompatibility,youshouldstillbeawareofthesedifferences.
OSXpriortoversion10.5providedtoolsthatgenerallyfollowBSDsemantics(or,insomecases,LinuxorGNU
semantics).BeginninginOSXv10.5,manyofthesetoolsinsteadobeyAT&Tsemantics(mostofthetime;see
notebelowforexceptions).Thus,sometoolsbehavedifferentlydependingontheversionofOSX.These
differencesaredescribedinthemanualpagesfortheindividualtools.
Note:  WhiletoolsinOSXv10.5andlatergenerallyobeyAT&Tsemantics,thisisnotalwaystrue.In
particular,whenexecutedfrominstallerscriptsorstartupitems,theyobeyBSDsemanticsfor
backwardscompatibilitywithexistingscripts.
Asaconveniencetoscriptdevelopers,youcanalsoobtainlegacybehaviorfrommostcommand-line
toolsbysettingcertainenvironmentvariablesasdescribedinthe
compat
manualpage.
Formoreinformationonlegacy-modecommandsupport,seeUnix03ConformanceReleaseNotes,
the
compat
manualpage,andthemanualpagesforindividualcommands.
awk
InoperatingsystemsthatfollowAT&Tsemantics,the
awk
commandsupportscertainformsofextendedregular
expressions(suchas
{n,m}
,
[[==]]
,and
[[..]]
)withoutexplicitlysettingflagstoenableextendedregular
expressionsupport.Becausethisbehaviorisnotportable,youshouldnotdependonit.
Becauseofthisdifference,ifyoufindaregularexpressionthataparticular
awk
interpretercannothandle,you
shouldfirsttryenablingextendedregularexpressionsupportandthenseeiftheproblemgoesaway.Thiswill
usuallybreakotherpartsoftheexpression,however.Ifso,youmustrewritetheregularexpressiontofullyuse
theextendedregularexpressionsyntax.
Tolearnaboutbasicandextendedregularexpressions,readRegularExpressionsUnfettered (page 100).To
learnmoreaboutthe
awk
interpreter,readthemanualpagefor
awk
.TolearnmoreabouttheAWKscripting
language,readHowAWK-ward (page 122).
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
152
control SDK platform:C# PDF Page Replace Library: replace PDF pages in C#.net, ASP.NET
PDF Library - Replace PDF Pages in C#.NET. An Excellent PDF Control Allows C# Users to Replace the Original PDF Page with New PDF Page from Another PDF File in
www.rasteredge.com
control SDK platform:VB.NET PDF Page Replace Library: replace PDF pages in C#.net, ASP.
& pages edit, C#.NET PDF pages extract, copy, paste, C# to replace a PDF page with another PDF file page. Support to save multiple PDF pages to anther adobe PDF
www.rasteredge.com
chown
Ifyoupassthe
-P
flagto
chown
,itdoesnotfollowsymboliclinks.Thus,thefilethatasymboliclinkpointsto
isnevermodifiedifyouspecifythe
-P
flag.
However,inoperatingsystemsthatfollowAT&Tsemantics,whenyouissuethecommand
chown -RP
directory_name
,theuserIDofthesymboliclinkitselfismodified.InoperatingsystemsthatfollowBSD
semantics,thesymboliclinkitselfisnotmodified.
cp
Ifyoupassboththe
-i
and
-f
flagsto
cp
,theflagthattakesprecedencevariesamongoperatingsystems.
Theseflagsspecifyoppositebehavior,soyoushouldneverusethemtogether.
Also,the
-f
optionhasdifferentbehaviordependingontheoperatingsystem:
AT&Tsemantics
BSDsemantics
Flags
Destinationfilepermissionssettodefault
permissions.
Destinationfilepermissions
unchanged.
-f
without
-p
Destinationfilepermissionssetto
permissionsofsourcefile.
Destinationfilepermissionssetto
permissionsofsourcefile.
-f
with
-p
Finally,inoperatingsystemsthatfollowAT&Tsemantics,whencopyingrecursively,thecopyoperationstops
assoonasanyerroroccurs.InoperatingsystemsthatfollowBSDsemantics,copyoperationcompletestothe
maximumextentpossible.Ineithercase,thecommandexitswithanonzeroresultcode.
Ifyouneedtoensurethatacopyoperationdoesnotstoponfirstfailure,youcanuse
tar
instead.Foran
exampleofhowtouse
tar
tocopyfiles,seeAnonymousSubroutines (page 84).
crontab
InAT&T-basedUNIXsystems,the
crontab
commandreadsfromstandardinputbydefault,butonBSD-based
systems,itdoesnot.Forcross-platformcompatibility,youshouldspecifyahyphen(
-
)forthefilenameinstead.
Thisworksonwithversionsof
crontab
thatobeybothAT&TandBSDsemantics.
date
Theresultcodesreturnedby
date
varydependingontheoperatingsystem.Forcross-platformcompatibility,
youcanonlyassumethataresultcodeofzero(
0
)indicatessuccessandanyothervalueindicatessomesort
offailure.
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
153
control SDK platform:C# PDF File & Page Process Library SDK for C#.net, ASP.NET, MVC
You can use specific APIs to copy and get a specific page of PDF file; you can also copy and paste pages from a PDF document into another PDF file.
www.rasteredge.com
control SDK platform:C# PDF Page Rotate Library: rotate PDF page permanently in C#.net
Able to save to another PDF file after rotating PDF pages. Copy this demo code to your C# application to rotate C#.NET Demo Code to Rotate All PDF Pages in C#
www.rasteredge.com
df
The
df
commandhastwodifferentmeaningsforthe
-t
flagbeginninginOSXv10.5.Theyareasfollows:
Ifyouincludeavalueafterwards(forexample,
-t hfs
),itbehaveslikethe
-T
flag.Thisusageisdeprecated.
Withoutanargument,ittells
df
toprintthetotalallocatedspace.Becausethisoptionisthedefault,this
useofthe
-t
flagisunnecessary.
Thedefaultblocksizevariesondifferentoperatingsystems.LinuxandmostBSD-basedoperatingsystems
defaulttoa1kblocksize,whileAT&TUNIX-basedoperatingsystemsdefaulttoa512-byteblocksize.
Forconsistentbehavioracrossmultipleoperatingsystems,youshouldalwaysspecifyablocksizeexplicitly.
Forexample,the-kflagspecifiesthattheblocksizeshouldbereportedinkilobytes.
Finally,thecapacitypercentagereportedby
df
mayberoundeddifferentlyindifferentoperatingsystems.
dos2unixandunix2dos
LinuxprovidesthesetwoutilitiesforconvertingbetweenUNIX-styleandDOS-stylelineendings.Usingthese
toolsisnotportable,andOSXdoesnotprovidetheseutilities.
Insteadofusing
dos2unix
or
unix2dos
,youshouldinsteaduse
tr
or
sed
asdescribedinCross-Platform
LineEndings (page 147).
du
OperatingsystemsthatfollowAT&Tsemanticsallowyoutopassacombinationofthe
-L
,
-H
,and
-P
options
to
du
.Thelastflagencountereddeterminesthecommand'sbehavior.InoperatingsystemsthatfollowBSD
semantics,specifyingmorethanoneoftheseoptionsresultsinanerror.Tofixthisproblem,deleteallbutthe
lastoftheseoptions.
Also,manyBSD-basedoperatingsystemscannotdetectsymboliclinkloops.Forcross-platformcompatibility,
youshouldgenerallynottell
du
tofollowsymboliclinksunlessyouarecertainthatnocyclescanoccur.
echo
Ofparticularinterestisthedifferenceinbehaviorofthe
echo
builtinandthecorrespondingstandalone
command.Ifyouwanttoissueaprompt,inBSD-derivedoperatingsystemsyoucanleaveoffthetrailing
newlinebytypingthefollowing:
echo -n "Prompt: "
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
154
control SDK platform:VB.NET PDF File Merge Library: Merge, append PDF files in vb.net
Combine multiple specified PDF pages in into single one file. Merge PDF without size limitation. Append one PDF file to the end of another one in VB.NET.
www.rasteredge.com
control SDK platform:C# PDF File Merge Library: Merge, append PDF files in C#.net, ASP.
Free online C#.NET source code for combining multiple PDF pages together in .NET framework. Append one PDF file to the end of another and save to a single
www.rasteredge.com
InAT&TUNIX-derivedoperatingsystems,theequivalentis:
echo "Prompt: \c"
Unfortunately,thisdifferencemakesitverydifficulttowritescriptsthatdependonthisbehaviorina
cross-platformway.Forportability,youshouldavoideitheroftheseconstructions.Asanalternative,youcan
eitherusethe
printf
commandinsteadof
echo
orusethe
tr
commandtoremovethenewline.
Forexample,thefollowinglinesbothprint"Prompt:“followedbytheword“newline”immediatelyafterward
onthesameline:
echo "Prompt: " " | | tr -d d '\n'; ; echo "newline"
printf "Prompt: "; printf f "newline\n";
The
echo
commandalsovariesinthewayithandlescontrol-characterescapesequencessuchas
\r
.Because
thesearehandleddifferentlyindifferentoperatingsystems,youshouldavoidusingthemwith
echo
.Asan
alternative,usethe
printf
commandtoprintthesesequences,orstorethedesiredcontrolcharacterina
shellvariableusing
printf
or
tr
.
Forexample,thefollowingcodesendsanXON(Control-Q)bytetostandardoutput:
XON="$(echo 'x' ' | | tr 'x' ' "\\021")"
echo "Here e is s an XON: $XON"
Note:  Thebehaviorof
-n
,
\c
,andotherescapesequencesmayalsovarybetweenshellbuiltin
versionsof
echo
andthe
/bin/echo
executable,dependingontheoperatingsystemandtheshell
youareusing.
file
The
file
commandhastwoswitchesthatbehavedifferentlyindifferentoperatingsystems:
-i
and
-r
(or
--raw
).Forconsistentbehavior,youshouldavoidtheseswitches.
InAT&TUNIX-basedoperatingsystems,the
-i
optiontellsthe
file
commandtonotclassifythecontentsof
regularfilesusingtheexternal
mime.types
file.Thisresultsinfasterperformancebutprovideslessdetailed
analysis.
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
155
control SDK platform:C# PDF Text Extract Library: extract text content from PDF file in
Enable extracting PDF text to another PDF file, TXT and source PDF document file with a copy-and-paste C# example code for text extraction from all PDF pages.
www.rasteredge.com
control SDK platform:VB.NET PDF copy, paste image library: copy, paste, cut PDF images
PDF document images. Allow to copy an image from existing PDF file and paste it into another one. Guarantee high performance image
www.rasteredge.com
InBSD-derivedoperatingsystems,the
-i
flagtellsthe
file
commandtooutputrawmimetypestringsrather
thanthemoretraditionalhumanreadableones.Forthisbehavior,youshouldusethe
--mime
flaginstead,
thoughthatoptionisalsonotsupporteduniversally.
The
-r
and
--raw
optionsaresupportedonlyinBSD-derivedoperatingsystems.Theseflagstellthefile
commandnottotranslateunprintablecharacterstotheiroctalrepresentations.AT&T-derivedoperatingsystems
neverdothis.
grep
Insomeoperatingsystems,
grep
failssilentlyifyoutrytomatchacaretinthemiddleofaline,whileother
versionsof
grep
warnaboutthemistake.Suchanexpressionisnotalegalregularexpression,ofcourse,but
ifyourscriptdependsongettinganerrorinthiscase(ornotgettinganerror),thescriptisnotfullyportable.
head
The
head
commandexistsacrossmostoperatingsystems.However,differentversionsprovideseveralflags
thatarenonstandard.
Theonlyflagthatcanbeusedportablyisthe
-n
flag,whichtakesalinecount.
Mostoperatingsystems(includingOSX)alsosupportthe
-c
flag,whichspecifiesabytecount,butthissupport
isnotguaranteedtobeportable.ItispossibletoemulatethisfunctionalityportablywiththehelpofanAWK
script,however,asfollows:
Listing10-3 Emulatinghead-cusingAWK:01_head_c.sh
#!/bin/sh
# Usage: : ./head_c filename bytecount
FILENAME=$1
COUNT=$2
SCRIPT="$(mktemp '/tmp/head_c.XXXXXXXXXX')"
cat << < EOF > > "$SCRIPT"
BEGIN {
FS="";
my_string = = ""
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
156
}
{
my_string = = my_string g "\n" \$0;
}
END {
# Start from m character 2 2 to o skip p the e bogus s leading newline.
print substr(my_string, , 2, , $COUNT);
}
EOF
awk -f f "$SCRIPT" " "$FILENAME"
rm "$SCRIPT"
YoumayalsorunintoaminorcompatibilityproblemwhenportingscriptsfromLinuxtoOSX.Whenyoupass
multiplefilenamestothe
head
command,itprintsaheadinglineforeachfilenameintheform
==> filename <==
TheLinuxversionof
head
providesa
-q
flagthatdisablesprintingtheheadermarkerevenifyouspecify
multiplefiles.Italsoprovidesa
-v
flagthatforcesheaderprintingevenwhenonlyonefileisspecified.
Asanalternativetothe
-v
flag,youcanoutputthefilenamemarkerinyourscriptwithasimple
echo
statement
likethisone:
echo "==> > $FILENAME <=="
Asanalternativetothe
-q
flag,providedthatthereisnopossibilityofyourfiles’contentsactuallymatching
thepattern,youcanstripoutthemarkerswith
grep
likethis:
head -n 1 1 file1 file2 2 ... | | grep -v v '^==>.*<==$'
Inadditiontotheseflagdifferences,POSIXspecifiesthattheinputfilesfor
head
mustbevalidtextfiles,which
meansthatallbytesequencesmustbevalidforthecurrentlocale.Althoughnotallversionsof
head
enforce
thisrestriction,versionsthatdomayfailwhenusedwithbinaryfilesinsomeoperatingsystemsunlessyou
changethelocalsettings.
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
157
Ifyourscriptsmustprocessbinaryfiles,besuretospecifythe“C”localebeforeexecutingcommandsthatwork
withthesebinaryfiles.Tochangethelocale,issuethefollowingstatement:
export LANG="C"
join
The
-e
optiontellsthe
join
commandtoinsertthespecifiedstringintoemptyfields.Inoperatingsystems
thatfollowBSDsemantics,substitutionoccursonlyiftherearenononemptyfieldsaftertheemptyfield.In
operatingsystemsthatfollowAT&TUNIXsemantics,substitutionalwaysoccurs.
Notall
join
flagsaresupportedonalloperatingsystems.Forportability,youshouldlimityourselfto
-a
,
-e
,
-o
,
-t
,
-v
,
-1
,and
-2
.
less
Seemoreorless (page 158).
ls
When
-H
isspecified(andisnotoverriddenby
-L
or
-P
)andafileargumentisasymboliclinkthatresolves
toanon-directoryfile,theoutputreflectsthenatureofthelink,ratherthanthatofthefile.Inoperatingsystems
thatfollowBSDsemantics,theoutputdescribesthefile.
The
-f
optionturnsonthe
-a
option(showfileswhosenameshaveaperiod(
.
)asthefirstcharacter).In
operatingsystemsthatfollowBSDsemantics,itdoesnot.
The
-o
optioncausesthelistingtobeinlongformat,buttoomitthegroupid.Inoperatingsystemsthatfollow
BSDsemantics,the
-o
optionmodifiesthe
-l
option,causingfileflagstobelisted.
The
-g
,
-n
,and
-o
optionsturnonthe
-l
option(causingthelistingtobeinlongformat).Inoperatingsystems
thatfollowBSDsemantics,theydonot.
mkfifo
InoperatingsystemsthatfollowBSDsemantics,the
mkfifo
commandappliesamaskof
0666
tothemode
passedinforthe
-m
option.InoperatingsystemsthatfollowAT&Tsemantics,nomaskisapplied.
moreorless
Differentoperatingsystemshandlethe
-n
and
-p
flagstothe
more
commanddifferently.
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
158
InoperatingsystemsthatfollowtheBSDandAT&Tsemantics,the
-n
optionspecifiesthenumberoflinesper
screen,andthe
-p
optionallowsyoutospecifycommands(suchas
:p
)toexecuteeachtimeanewscreenful
oftextisdisplayed.
InoperatingsystemsthatfollowLinuxsemantics(andforthe
less
commandonalloperatingsystems),the
-n
flagtellsthe
more
commandtotosuppresslinenumbering,andthe
-p
flagspecifiesasearchpattern.
mv
Ifyoutellthe
mv
commandtomoveasubdirectoryintoitscurrentparentdirectory(bytyping
mv foo/bar
foo
,forexample),thebehaviorvariesinasubtleway.Noactionoccursinanyoperatingsystembecauseyou
areeffectivelymovingadirectoryontopofitself.However,operatingsystemsthatfollowBSDsemanticsexit
withazero(success)resultcode,whereasoperatingsystemsthatfollowAT&Tsemanticsdisplayanerror
messageandexitwithanonzero(failure)resultcode.
pr
InAT&TUNIXsemantics,thelastspacebeforethetabstopisreplacedwithatabcharacter.Thisreplacement
doesnotoccurinmostopensource(BSDorLinux)implementations.Forcross-platformconsistency,youcan
globallyreplacethetabwithaspacebypipingtheoutputto
tr
withappropriatearguments.Forexample:
pr [arguments...] | | tr r '\t' ' ' ' '
ps
Whilenotfrequentlyusedinshellscripts,the
ps
commandbehavesverydifferentlybetweenoperatingsystems
thatfollowBSDandAT&Tsemantics.Thedifferencesaresummarizedinthefollowingtable:
BSD
AT&T
Flag
Displaytheenvironmentvariablesettings
foreachprocess;sameas
-E
.
Displayinformationaboutotherusers’
processes,includingthosewithoutcontrolling
terminals;sameas
-A
.
-e
Unusedoption.
Displayinformationaboutprocesseswiththe
specifiedsessionleaders.
-g
"Long”displayformat;doesnotinclude
the
paddr
field.
"Long”displayformat;includesthe
paddr
field.
-l
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
159
BSD
AT&T
Flag
Displaythefields
user
,
pid
,
%cpu
,
%mem
,
vsz
,
rss
,
tt
,
state
,
start
,
time
and
command
.Alsoimpliesthe
-r
option(sort
byCPUusage).
Displayprocessesbelongingtoaparticularuser.
Forexample,
ps -u root
displaysallprocesses
belongingtotherootuser.
-u
Note:  Forthemostpart,theinformationavailablefrom
ps
issimilarinallvariants(withtheexception
ofthe
-u
flag).Theheadingsthemselves,however,differsomewhatamongBSD,AT&T,andLinux
variantsofthe
ps
command.Similarly,columnorderisnotguaranteedtobeconsistentacross
platforms.Forthisreason,programmaticuseofpsisgenerallydiscouraged.
MostBSDandLinuxvariantshavedeprecatedtheuseofBSDvariantsofflagswhentheyareprecededbya
dash.PassingtheseflagswithoutadashintheseoperatingsystemswillgeneratetheBSDbehaviormore
consistently(atleastonBSDandLinux-basedoperatingsystems).However,becausethisbehaviorisnot
portable,youshouldgenerallynotdependonthespecificquirksofaparticular
ps
implementation.
rename
The
rename
commandisacommandthatexistsonsomeLinuxdistributions.Toaddfurtherconfusion,there
aretwoseparatecommandsthathavethisname,dependingonthedistribution,andthesyntaxforthetwo
commandsiscompletelydifferent:
InsomeLinuxdistributions,
rename
isacommandfromtheutil-linux-ngpackage,foundathttp://user-
web.kernel.org/~kzak/util-linux-ng/.
InotherLinuxdistributions,
rename
isaPerlscript,alsoknowninvariousincarnationsas
prename
or
perl-rename
thatshipsaspartofthePerldistribution.ThisscriptisavailablefromCPAN.
Becausetheuseofthe
rename
toolisnotportableevenacrossLinuxdistributions,youshouldgenerallyuse
the
find
command,ifpossible.
If
find
isinsufficient,youcaneasilyinstallthePerl
rename
commandusingthe
cpan
tool.Todothis,firstlog
ininasanadminuser,thenrunTerminal,thentype:
sudo cpan n File::Rename
The
sudo
commandthenasksyoutoenteryouradminpassword.
Oncethe
File::Rename
CPANpackageisinstalled,therenamecommandisin
/usr/local/bin
.
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
160
Documents you may be interested
Documents you may be interested