devexpress asp.net pdf viewer : Delete pages from pdf online Library application component .net html azure mvc AppleShellScripting-20143-part674

Thisproblemiseasilysolvedbyoverridingtheenvironmentvariable
PATH
onaper-executionbasis.Consider
thefollowingscript:
#!/bin/sh
echo $MYVAR
Thisscriptprintsthevalueofthevariable
MYVAR
.Normally,thisvariableisempty,sothisscriptjustprintsa
blankline.Savethescriptas
printmyvar.sh
,thentypethefollowingcommands:
chmod a+x printmyvar.sh
# makes the script executable
MYVAR=7 ./printmyvar.sh
# runs the script
echo "MYVAR IS $MYVAR"
# prints the variable
Noticethattheassignmentstatement
MYVAR=7
applies
only
tothecommandthatfollowsit.Thevalueof
MYVAR
isalteredintheenvironmentofthecommand
./printmyvar.sh
,sothescriptprintsthenumber7.
However,theoriginal(empty)valueisrestoredafterexecutingthatcommand,sotheechostatementafterwards
printsanemptystringforthevalueof
MYVAR
.
Thus,tomodifythe
PATH
variablelocallybutexecuteacommandwiththeoriginal
PATH
value,youcanwrite
ascriptlikethis:
#!/bin/sh
GLOBAL_PATH="$PATH"
PATH=/usr/local/bin
PATH="$GLOBAL_PATH" /bin/ls
UsingthesetenvBuiltin(Cshell)
IntheCshell,variablesareexportedifyousetthemwith
setenv
,butnotifyousetthemwith
set
.Thus,if
youwantyourshellvariablemodificationstobeseenbyanytoolorscriptthatyoucall,youshouldusethe
setenv
builtin.ThisbuiltinistheCshellequivalenttoissuinganassignmentstatementwiththe
export
builtinintheBourneshell.
setenv VALUE "Four"
echo "VALUE is '$VALUE'."
ShellScriptBasics
ExportingShellVariables
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
31
Delete pages from pdf online - Library application component: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
Delete pages from pdf online - Library application component: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
Ifyouwantyourshellvariablestoonlybeavailabletoyourscript,youshouldusethe
set
builtin(described
inShellVariablesandPrinting (page 23)).The
set
builtinisequivalenttoasimpleassignmentstatementin
theBourneshell.
set VALUE = "Four"
echo "VALUE is '$VALUE'."
Noticethatthelocalvariableversionrequiresanequalssign(
=
),buttheexportedenvironmentversiondoes
not(andproducesanerrorifyouputonein).
ToremovevariablesintheCshell,youcanusethe
unsetenv
or
unset
builtin.Forexample:
setenv VALUE "Four"
unsetenv VALUE
set VALUE = "Four"
unset VALUE
echo "VALUE is '$VALUE'."
Thiswillgenerateanerrormessage.IntheCshell,itisnotpossibletoprintthevalueofanundefinedvariable,
soifyouthinkyoumayneedtoprintthevaluelater,youshouldsetittoanemptystringratherthanusing
unset
or
unsetenv
.
Ifyouneedtotestanenvironmentvariable(notashell-localvariable)thatmayormaynotbepartofyour
environment(avariablesetbywhateverprocesscalledyourscript),youcanusethe
printenv
builtin.This
printsthevalueofavariableifset,butprintsnothingifthevariableisnotset,andthusbehavesjustlikethe
variablebehavesintheBourneshell.
Forexample:
set X = `printenv VALUE`
echo "X is "\"$X\"
Thisprints
X is ""
ifthevariableiseitheremptyorundefined.Otherwise,itprintsthevalueofthevariable
betweenthequotationmarks.
Ifyouneedtofindoutifavariableissimplyemptyorisactuallynotset,youcanalsouse
printenv
toobtain
acompletelistofdefinedvariablesanduse
grep
toseeifitisinthelist.Forexample:
ShellScriptBasics
ExportingShellVariables
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
32
Library application component:VB.NET PDF Page Delete Library: remove PDF pages in vb.net, ASP.
Easy to delete PDF page in .NET WinForms application and ASPX webpage. Enable specified pages deleting from PDF in Visual Basic .NET class.
www.rasteredge.com
Library application component:C# PDF Page Delete Library: remove PDF pages in C#.net, ASP.NET
able to delete PDF page in both Visual C# .NET WinForms and ASP.NET WebForms project. Free online C# class source code for deleting specified PDF pages in .NET
www.rasteredge.com
set DEFINED = `printenv | grep -c '^VARIABLE='`
Theresultingvariablewillcontain1ifthevariableisdefinedintheenvironmentor0ifitisnot.
OverridingEnvironmentVariablesforChildProcesses(CShell)
UnliketheBourneshell,theCshelldoesnotprovideabuilt-insyntaxforoverridingenvironmentvariables
whenexecutingexternalcommands.However,itispossibletosimulatethiseitherbyusingthe
env
command.
Thebestandsimplestwaytodothisiswiththe
env
command.Forexample:
env PATH="/usr/local/bin" /bin/ls
Asanalternative,youcanusethe
set
builtintomakeatemporarycopyofanyvariableyouneedtooverride,
changethevalue,executethecommand,andrestorethevaluefromthetemporarycopy.
Youshouldnotice,however,thatwhetheryouusethe
env
commandormanuallymakeacopy,the
PATH
variableisalteredpriortosearchingforthecommand.Becausethe
PATH
variablecontrolswheretheshell
looksforprogramstoexecute,youmustthereforeexplicitlyprovideacompletepathtothe
ls
commandor
itwillnotbefound(unlessyouhaveacopyin
/usr/local/bin
,ofcourse).The
PATH
environmentvariable
isexplainedinSpecialShellVariables (page 265).
Asaworkaround,youcandeterminethepathoftheexecutableusingthe
which
commandpriortoaltering
the
PATH
environmentvariable.
set GLOBAL_PATH = "$PATH"
set LS = `which ls`
setenv PATH "/usr/local/bin"
$LS
setenv PATH "$GLOBAL_PATH"
unset GLOBAL_PATH
Or,using
env
:
set LS = `which ls`
env PATH='/usr/local/bin' $LS
Theuseofthebacktick(`)operatorinthisfashionisdescribedinInlineExecution (page 68).
ShellScriptBasics
ExportingShellVariables
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
33
Library application component:C# PDF File & Page Process Library SDK for C#.net, ASP.NET, MVC
C# view PDF online, C# convert PDF to tiff, C# read PDF, C# convert PDF to text, C# extract PDF pages, C# comment annotate PDF, C# delete PDF pages, C# convert
www.rasteredge.com
Library application component:C# PDF Page Insert Library: insert pages into PDF file in C#.net
document files by C# code, how to rotate PDF document page, how to delete PDF page using C# .NET, how to reorganize PDF document pages and how
www.rasteredge.com
Security Note:  Ifyourpurposeforoverridinganenvironmentvariableistopreventdisclosureof
sensitiveinformationtoapotentiallyuntrustedprocess,youshouldbeawarethatifyouuse
setenv
forthecopy,thecalledprocesshasaccesstothattemporarycopyjustasithadaccesstotheoriginal
variable.Toavoidthis,besuretocreatethetemporarycopyusingthe
set
builtininsteadof
setenv
.
DeletingShellVariables
Forthemostpart,inBourneshellscripts,whenyouneedtogetridofavariable,settingittoanemptystring
issufficient.However,inlong-runningscriptsthatmightencountermemorypressure,itcanbemarginally
usefultodeletethevariableentirely.Todothis,usethe
unset
builtin.
Forexample:
MYVAR="this is a test"
unset MYVAR
echo "MYVAR IS \"$MYVAR\""
The
unset
builtincanalsobeusedtodeleteenvironmentvariables.
C Shell Note:  TheCshell
unset
builtinisidenticalexceptthatitcannotbeusedtodelete
environmentvariables.Use
unsetenv
instead,asshowninOverridingEnvironmentVariablesfor
ChildProcesses(CShell) (page 33).
Also,inCshell,ifyoutrytouseadeletedvariable,itisconsideredanerror.(InBourneshell,anunset
variableistreatedlikeanemptystring.)
ShellScriptBasics
DeletingShellVariables
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
34
Library application component:VB.NET PDF Page Insert Library: insert pages into PDF file in vb.
add and insert one or multiple pages to existing adobe PDF document in VB.NET. Ability to create a blank PDF page with related by using following online VB.NET
www.rasteredge.com
Library application component:C# HTML5 PDF Viewer SDK to view PDF document online in C#.NET
C# view PDF online, C# convert PDF to tiff, C# read PDF, C# convert PDF to text, C# extract PDF pages, C# comment annotate PDF, C# delete PDF pages, C# convert
www.rasteredge.com
TheBourneshellprovidesanumberofwaystoreadandwritefiles,displaytext,andgetinformationfromthe
user,including
echo
(describedpreviouslyinShellScriptBasics (page 21)),
printf
,
read
,
cat
,pipes,and
redirection.Thischapterdescribesthesemechanisms.
ShellScriptInputandOutputUsingprintfandread
TheBourneshellsyntaxprovidesbasicinputwithverylittleeffort.
#!/bin/sh
printf "What is your name?
-> "
read NAME
echo "Hello, $NAME.
Nice to meet you."
Youwillnoticetwothingsaboutthisscript.Thefirstisthatitintroducesthe
printf
command.Thiscommand
isusedbecause,unlike
echo
,the
printf
commanddoesnotautomaticallyaddanewlinetotheendofthe
lineofoutput.Thisbehaviorisusefulwhenyouneedtousemultiplelinesofcodetooutputasinglelineof
text.Italsojusthappenstobehandyforprompts.
Note:  Inmostoperatingsystems,youcantell
echo
tosuppressthenewline.However,thesyntax
fordoingsovaries.Thus,
printf
isrecommendedforprintingprompts.SeeDesigningScriptsfor
Cross-PlatformDeployment (page 146)formoreinformationandotheralternatives.
Thesecondthingyou'llnoticeisthe
read
command.Thiscommandtakesalineofinputandseparatesitinto
aseriesofarguments.Eachoftheseargumentsisassignedtothevariablesinthe
read
statementintheorder
ofappearance.Anyadditionalinputfieldsareappendedtothelastentry.
Youcanmodifythebehaviorofthe
read
commandbymodifyingtheshellvariable
IFS
(shortforinternal
fieldseparators).Thedefaultbehavioristosplitinputseverywherethereisaspace,tab,ornewline.Bychanging
thisvariable,youcanmaketheshellsplittheinputfieldsbytabs,newlines,semicolons,oreventheletter'q'.
Thischangeinbehaviorisdemonstratedinthefollowingexample:
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
35
Shell Input and Output
Library application component:VB.NET PDF- View PDF Online with VB.NET HTML5 PDF Viewer
RasterEdge. PRODUCTS: ONLINE DEMOS: Online HTML5 Document Viewer; Online XDoc.PDF C# File: Split PDF; C# Page: Insert PDF pages; C# Page: Delete PDF pages;
www.rasteredge.com
Library application component:VB.NET PDF - Convert PDF Online with VB.NET HTML5 PDF Viewer
C# view PDF online, C# convert PDF to tiff, C# read PDF, C# convert PDF to text, C# extract PDF pages, C# comment annotate PDF, C# delete PDF pages, C# convert
www.rasteredge.com
#!/bin/sh
printf "Type three numbers separated by 'q'. -> "
IFS="q"
read NUMBER1 NUMBER2 NUMBER3
echo "You said: $NUMBER1, $NUMBER2, $NUMBER3"
If,forexample,yourunthisscriptandenter
1q3q57q65
,thescriptreplieswith
You said: 1, 3, 57q65
.
Thethirdvaluecontains
57q65
becauseonlythreevaluesarerequestedinthereadstatement.
Note:  The
read
statementalwaysstopsreadingatthefirstnewlineencountered.Thus,ifyouset
IFS
toanewline,youcannotreadmultipleentrieswithasingle
read
statement.
Warning:  Changing
IFS
maycauseunexpectedconsequencesforvariableexpansion.Formore
information,seeVariableExpansionandFieldSeparators (page 62).
Butwhatifyoudon’tknowhowmanyparameterstheuserwillspecify?Obviously,asinglereadstatement
cannotsplittheinputupintoanarbitrarynumberofvariables,andtheBourneshelldoesnotcontaintrue
arrays.Fortunately,the
eval
builtincanbeusedtosimulateanarrayusingmultipleshellvariables.This
techniqueisdescribedinUsingtheevalBuiltinforDataStructures,Arrays,andIndirection (page 168).
Alternatively,youcanusethe
for
statement,whichsplitsasinglevariableintomultiplepiecesbasedonthe
internalfieldseparators.ThisstatementisdescribedinTheforStatement (page 52).
ShellInputandOutput
ShellScriptInputandOutputUsingprintfandread
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
36
Library application component:VB.NET PDF - Annotate PDF Online with VB.NET HTML5 PDF Viewer
VB.NET PDF - Annotate PDF Online with VB.NET HTML5 PDF Viewer. Explanation about transparency. VB.NET HTML5 PDF Viewer: Annotate PDF Online. This
www.rasteredge.com
Library application component:C# HTML5 PDF Viewer SDK to convert and export PDF document to
C# view PDF online, C# convert PDF to tiff, C# read PDF, C# convert PDF to text, C# extract PDF pages, C# comment annotate PDF, C# delete PDF pages, C# convert
www.rasteredge.com
C Shell Note:  IntheCshell,thesyntaxforreadingiscompletelydifferent.Thefollowingscriptis
theCshellequivalentofthescriptearlierinthissection:
printf "What is your name? -> "
set NAME = "$<"
echo "Hello, $NAME.
Nice to meet you."
TheCshelldoesnotprovideawaytoreadmultiplevaluesinasinglecommand,thoughyoucan
approximatethiswithcarefuluseof
sed
asdescribedinRegularExpressionsUnfettered (page 100)
or
cut
.Forexample:
#!/bin/csh
printf "Type three numbers separated by 'q'. -> "
set LINE = "$<"
set NUMBER1 = `echo "$LINE" | cut -f 1 -d 'q'`
set NUMBER2 = `echo "$LINE" | cut -f 2 -d 'q'`
set NUMBER3 = `echo "$LINE" | cut -f 3 -d 'q'`
echo "You said: $NUMBER1, $NUMBER2, $NUMBER3"
BulkI/OUsingthecatCommand
ForsmallI/O,the
echo
commandiswellsuited.However,whenyouneedtocreatelargeamountsofdata,it
maybeconvenienttosendmultiplelinestoafilesimultaneously.Forthesepurposes,the
cat
commandcan
beparticularlyuseful.
Byitself,the
cat
commandreallydoesn’tdoanythingthatcan’tbedoneusingredirectoperators(exceptfor
printingthecontentsofafiletotheuser’sscreen).However,bycombiningitwiththespecialoperator
<<
,you
canuseittosendalargequantityoftexttoafile(ortothescreen)withouthavingtousethe
echo
command
oneveryline.
Forexample:
cat > mycprogram.c << EOF
ShellInputandOutput
BulkI/OUsingthecatCommand
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
37
#include <stdio.h>
int main(int argc, char *argv[])
{
char array[] = { 0x25, 115, 0 };
char array2[] = { 68, 0x61, 118, 0x69, 0144, 040,
0107, 97, 0x74, 119, 0157, 0x6f,
100, 0x20, 0x72, 117, 'l', 0x65,
115, 041, 012, 0 };
printf(array, array2);
}
EOF
Thisexamplescripttakesthetextafterthelinecontainingthe
cat
commandupto(butnotincluding)the
linethatbeginswith
EOF
andstoresitintothefile
mycprogram.c
.Notethatthetoken
EOF
canbereplaced
withanytoken,solongasthefollowingconditionsaremet:
Thetokenmustnotcontainspacesunlessyousurrounditwithquotationmarks.(Theseouterquotation
marksarenotconsideredpartofthetokenunlessyouquotethem.)
Shellvariablesinthenameofthetokenarenotexpanded,sothe
$
characterisjustlikeanyotherordinary
character.
Thetokenafterthe
<<
inthestartinglinemustmatchthetokenatthebeginningofthelastline.
Theend-of-blocktokenmustbetheonlythingthatappearsontheline.Ifitsharesthelinewithanyother
characters(includingwhitespace),itwillbetreatedaspartofthetexttobeoutput.
Theend-of-blocktokenyouchoosemustneverappearasalineintheintendedoutputstring.
Thistechniqueisalsofrequentlyusedforprintinginstructionstotheuserfromaninteractiveshellscript.This
avoidstheclutterofdozensoflinesof
echo
commandsandmakesthetextmucheasiertoreadandeditin
anexternaltexteditor(ifdesired).
ShellInputandOutput
BulkI/OUsingthecatCommand
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
38
Note:  Althoughshellvariablescannotbeusedtodefinethetokenitself,bydefault,shellvariables
are
expandedwithinthestringtobeprinted.Todisablethisexpansion,surroundthetokenwith
singleordoublequotemarks.Forexample:
cat << 'EOF'
The variable in this line will not be expanded: $PATH
EOF
Noticethat
EOF
doesnotappearinquotesintheactualtext.Thisisakeydifferencebetweenthe
BourneshellandCshellbehavior.IfyouwanttoexplicitlylookforEOFwithinsinglequotes,you
wouldwriteitlikethis:
cat << "'EOF'"
...
'EOF'
or
cat << \''EOF'\'
...
'EOF'
Anotherclassicexampleofthisuseof
cat
inactionisthe
.shar
fileformat,createdbythetool
shar
(short
forSHellARchive).Thistooltakesalistoffilesasinputandusesthemtocreateagiantshellscriptwhich,when
executed,recreatesthoseoriginalfiles.Toavoidtheriskoftheend-of-blocktokenappearingintheinputfile,
itprependseachlinewithaspecialcharacter,thenstripsthatcharacteroffonoutput.
ShellInputandOutput
BulkI/OUsingthecatCommand
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
39
C Shell Note:  Themultiline
cat
syntaxintheCshellisthesameasintheBourneshell,withone
keydifference:theentiretokenistreatedasliteraltextformatchingpurposes,includingbackslashes
andquotationmarks.Forexample:
cat << 'EOF'
The variable in this line will not be expanded: $PATH
'EOF'
Foranotherexample:
cat << \''EOF'\'
The variable in this line will not be expanded: $PATH
\''EOF'\'
Inbothcases,thequotationmarksstillbehaveasaswitchtocontrolwhetherornottoexpand
variableswithintheoutput.
PipesandRedirection
Asyoumayalreadybeaware,thetruepowerofshellscriptingliesnotinthescriptsthemselves,butinthe
abilitytoreadandwritefilesandchainmultipleprogramstogetherininterestingways.
EachprograminaUNIX-basedorUNIX-likesystemhasthreebasicfiledescriptors(normallyareferencetoa
fileorsocket)reservedforbasicinputandoutput:standardinput(oftenabbreviatedstdin),standardoutput
(stdout),andstandarderror(stderr).
Thefirst,standardinput,normallytakesinputfromtheuser'skeyboard(whentheshellwindowisinthe
foreground,ofcourse).Thesecond,standardoutput,normallycontainstheoutputtextfromtheprogram.The
third,standarderror,isgenerallyreservedforwarningorerrormessagesthatarenotpartofthenormaloutput
oftheprogram.Thisdistinctionbetweenstandardoutputandstandarderrorisaveryimportantone,as
explainedinPipesandFileDescriptorRedirection(BourneShell) (page 42).
BasicFileRedirection
OneofthemostcommontypesofI/Oinshellscriptsisreadingandwritingfiles.Fortunately,itisalsorelatively
simpletodo.Readingandwritingfilesinshellscriptsworksexactlylikegettinginputfromorsendingoutput
totheuser,butwiththestandardinputredirectedtocomefromafileorwiththestandardoutputredirected
toafile.
ShellInputandOutput
PipesandRedirection
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
40
Documents you may be interested
Documents you may be interested