shell-scripting-tutorial开源项目

我要开发同款
匿名用户2021年11月09日
45阅读
开发技术SHELL
所属分类终端/远程登录、应用工具
授权协议Readme

作品详情

ShellScriptingTutorial

Keepintouchwithforanykindoftechnicalquestions

ShellScriptingforAmazonWebServicestoManageit'sresources

https://techtutorials.github.io/shell-scripting-tutorial/

FacebookEmailListLinkedinTwitterYoutubeEmailAddressWhatsAppGroupLinuxTelegramGroupRedditTechTutorialsTumblr

AcompletebegineersguidetolearnshellscriptingfromscratchwhichincludesVideos,Practicescenariosandprojectidea.Iwillcreateonefileforonetopicwithcode.

BeforejumpingintotheShellscriptingbelowarecommandsyouhavetopracticeforbetterunderstandingandfamiliarwithLinuxcommandlineinterface.

Ifyoudonotlearnbelowcommandsalsofinebutipersonallyrecommendyoutolearncommandsfirst.

103LinuxCommandsVideoTutorial

aliasandunalias,arch,arp,at,awk,bc,blkid,cal,cat,cd,chage,chattr,chgrp,chmod,chown,cp,cpio,crontab,curl,cut,date,dd,df,diff,dig,dnf,du,expr,fdisk,file,find,firewall-cmd,free,ftp,grep,head,history,hostname,id,ifconfig,iostat,ip,kill,last,lessandmore,ln,locate,lpstatandlpadmin,ls,lsof,lspci,mail,man,mdadm,mkdirandrmdir,mkisofs,mount,mutt,mv,nano,netstat,nice,renice,nslookup,passwd,pam_tally2,paste,ping,perloneliner,pkill,ps,pwd,reboot,poweroff,rm,rpm,rsync,scp,screen,sed,sort,ss,ssh,sysctl,tail,tar,tcpdump,top,touch,tr,traceroute,umask,uname,uniq,uptime,useradd,vi,vmstat,w,who,watch,wc,wget,ypcat,yppasswd,yum,zip,sar

Afterthatstartlearningshellscriptingusingbelowtopics

ShellScriptingVideoTutorialShellScriptingcourseOverviewLinuxBasicsLinuxDirectoryStructureLinuxBasicCommandsCopy,Remove,MoveandTimeCommandsDifandGrepCommandsHead,tail,sortandmorecommandstrandwccommandsDiskutilitieslikefdisk,dfandducommandsGettingHelpFromCommandLineuserInterfacew,who,hostnamemhostnamectlandunamecommandsSearchforfilesanddirectoriesusingfindandlocatecommandstopcommanditsoutputexplanationvi&vimtexteditorsed,awk,vmstatandnestatcommandsvnstatcommandIntroductiontoGraphicaluserinterfacecutcommandMergemultiplefilesusingpastecommandConnectandManageremotemachineusingSSHChangingfilesanddirectorypermissionstarandzipcommandsSchedulingfuturejobsusingcrontabdifferencebetweenscriptingandprogrammingwhatisshellscriptingandit'sadvantagesPATHenvironmentvariableSymbolsusedshellscriptingMakeShellScriptTemplateQuotessingle,doubleandreverse-KnowdifferencebetweeneachBashcolorsScriptexitstatusVariablesandit'srulesSpecialVariablesEnvironmentVariables,systemvariablesanduserdefinedvariablesConstantvariables,Local&GlobalvariablesandSpecialvariablesPositionalParametersCountnumbercommandlinearguments$#ArithmeticOperatorsRelationalOperatorsLogicalOperatorsBooleanOperatorsMathsusingexprcommandRealmathsusingbccommandifstatementif-elsestatementif-else-ifstatementNestedifstatementCasestatementForLoopWhileLoopUntilLoopFunctionsArraysEvalcommandShiftingparametersusingshiftcommandIFS-InputFieldSeparatorWritingCPUUsagescriptWritingDiskUtilizationscriptTroubleshootingdebuggingshellscriptsCheckingshellscripterrorsandimprovementsusingshellcheck.netsiteHereDocumenttowriteparagraphsoftextGetoptsFunctionExecutingMultiplescriptsfromsinglescriptloggerloggingmessagestologfile

ResourcetoDownload

ShellScriptingBookShellScriptingBookShellScriptingBookShellScriptingBook

WriteYourOwnMethodofScriptforbelowScenario

Scenario:EverydayfromMondaytoFridayonedirectorywillbecreatedunder/fullbackup/dailybackup/YYYY-MM-DDanditwillmovebackuptoitsparentdirectoryeverydaymidnight/fullbackup/archive/,HoweverSaturday,SundayandMondaydirectorieswillmoveto/fullbackup/archivepatheverymondayevening.

DirectoryNamesExample:2018-12-242018-12-252018-12-262018-12-272018-12-28

Question:Iwouldliketodeletedirectoriesolderthantwodaysfrom/fullbackup/archivepath.Howdoyoudoitusinganyscriptingmethods.

ProblemStatement:Iwastryingtousefind/path/-typed-mtime+2-print0|xargs-r0rm--.ThiscommanddoesnotworkasexpectedduetodirectorymodifieddateforSAT,SUNandMONmoveddirectoriessameforallasMondaydate.

HowDoyousolveit.??WriteShellScripttoaccomplishthistask.Shouldrunthroughcrontabandcleardirectoriesolderthantwodays.

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论