Originally posted by Snowhog
View Post
Announcement
Collapse
No announcement yet.
CLI system updates - little script help...
Collapse
This topic is closed.
X
X
-
- Top
- Bottom
-
Cool! I like that. Shorter code, which is consistent with the idea of an alias as well! I've made the change.
- Top
- Bottom
Leave a comment:
-
Originally posted by Snowhog View Postalias sL="clear && grep -v [#] /etc/apt/sources.list | awk 'NF'"
alias sL='grep "^[^#]" /etc/apt/sources.list'
(there's nothing better than shaving off a few nanoseconds from your aliases ..."^[^#]" means "line begins with a character that's not '#'"...so it will shave off of both commented repos and empty lines)
- Top
- Bottom
Leave a comment:
-
Hehe. Yup. ea was created earlier, and I had forgotten about it when I create na. Removed ea and updated na for 'global' use. Thanks again.
Added:
Made the following change to my sL alias:
alias sL="clear && grep -v [#] /etc/apt/sources.list | awk 'NF'"Last edited by Snowhog; Jul 06, 2013, 12:50 PM.
- Top
- Bottom
Leave a comment:
-
Originally posted by Snowhog View PostI like a 'clean' console when outputting a new command.
I fixed the two aliases so they will work 'globally' in the console. Thanks for pointing out the omissions.
- Top
- Bottom
Leave a comment:
-
I like a 'clean' console when outputting a new command.
I fixed the two aliases so they will work 'globally' in the console. Thanks for pointing out the omissions.
- Top
- Bottom
Leave a comment:
-
I also use aliases.
Code:alias a='clear && alias | more'alias addppa='sudo add-apt-repository' alias aremove='clear && sudo apt-get autoremove' alias chattr='sudo chattr' alias checkHD='clear && sudo smartctl --all /dev/sda' alias chkrk='clear && sudo chkrootkit' alias clean='clear && sudo apt-get clean' alias cleanup='clear && sudo apt-get --purge autoremove && sudo apt-get clean && sudo updatedb' alias debs='clear && ls -l /var/cache/apt/archives && ls -l /var/cache/apt/archives/partial' alias dependson='clear && apt-cache depends' alias dfsee='cd dfsee11x_linux/linux && sudo ./dfsee' alias dgrub='clear && cat /etc/default/grub' alias distupgrade='clear && sudo apt-get dist-upgrade' alias dload='aria2c ' alias ea='clear && nano .bash_aliases' alias findit='clear && sudo find /* -mount -name' alias fstab='clear && cat /etc/fstab' alias getISO='aria2c -x2 ' alias gpgkeys='clear && gpg --list-keys' alias grub='clear && less /boot/grub/grub.cfg' alias info='apt-cache policy' alias install='clear && sudo apt-get install' alias installNR='clear && sudo apt-get install --no-install-recommends' alias installed='dpkg --get-selections | grep install > junk' alias itsin='clear && apt-file find' alias kcmshell4='clear && kcmshell4 --list | sort' alias kfn='clear && ping www.kubuntuforums.net' alias killall='sudo killall -9' alias killzombie='sudo kill -9' alias kscrubber='clear && sudo kscrubber' alias la='clear && alias' alias ls.='ls -d .*' alias ls='ls --color=auto' alias mp32wav='lame --decode' alias mtab='clear && cat /etc/mtab' alias myOS='clear && lsb_release -d -c' alias myhdd='clear && sudo sfdisk -uS -l /dev/sda' alias mykernels="dpkg --list | awk '/linux-image/ {print \$2}' && cat Documents/Remove\ a\ Kernel" alias no#='clear && grep -v [#]' alias purge='clear && sudo apt-get remove --purge' alias revdepends='clear && apt-cache showpkg' alias rkh='clear && sudo rkhunter --check' alias rkhdb='clear && sudo rkhunter --propupd' alias sL='clear && cat /etc/apt/sources.list' alias scanPC='clear && sudo chkrootkit && sudo rkhunter --check' alias sessions='clear && ls -lat ~/.kde/share/config/session/' alias show='clear && sudo apt-cache show' alias simI='clear && sudo apt-get install --simulate' alias simINR='clear && sudo apt-get install --no-install-recommends --simulate' alias simP='clear && sudo apt-get purge --simulate' alias simR='clear && sudo apt-get remove --simulate' alias simU='clear && sudo apt-get dist-upgrade --simulate' alias snano='sudo nano' alias startkdm='clear && sudo service kdm start' alias ua='clear && source ~/.bash_aliases' alias ugrub='sudo update-grub2' alias update='clear && sudo apt-get update && sudo apt-file update' alias updatedb='clear && sudo updatedb' alias used='clear && df -hT --exclude-type=tmpfs --exclude-type=devtmpfs' alias version='clear && apt-cache policy' alias zombies='clear && ps -elF | grep Z' alias inxic='echo Go to http://code.google.com/p/inxi/source/list to see current changes to inxi' alias recordit="avconv -f x11grab -s $(xdpyinfo | awk '/dimensions/ {print $2}') -i :0.0 -vcodec libtheora -q 10 vid.mkv" alias na='nano .bash_aliases' alias login='Xephyr :1 -query 127.0.0.1 -screen 1024x768' alias weather='inxi -Zwxxx -W=wasilla,ak' alias list='ls -la' alias INXI='sudo inxi -U'
- Top
- Bottom
Leave a comment:
-
Originally posted by oshunluvr View PostI like to see what's going to be installed before going for it so I need to build in a break there or something.
- Top
- Bottom
Leave a comment:
-
Originally posted by kubicle View PostP.S. I'm not native in English, but I think "responce" should be spelled "response"
I thought of some command line switches but I haven't figured the best way to add those yet. For my personal taste, I like to see what's going to be installed before going for it so I need to build in a break there or something. I'm still tinkering with it but I'm getting the family/house ready for a long trip to France [/brag] so I may not finish it real soon. It's at least partially an exercise to get my head back into programming mode. I quit college in 1982 but now that my main career is over I'd like to get back into programming as a hobby. I write little Service Menus to do stuff I do often and I'm trying to automate my server as much as possible but I'd really like to write a useful app like a full featured hard drive manager or maybe a working distro install tool. That will probably have to wait until next year after we move to the left coast.
- Top
- Bottom
Leave a comment:
-
I tend to use aliases, but since you asked for improvement suggestions, I'd add some command line options for the script, like:
-a|--automatic == run default actions without asking (update/dist-upgrade/exit)
-i|--interactive == ask what do to (as the current script does)
-s|--safe-upgrade == upgrade instead of dist-upgrade
-c|--clean == run clean after upgrade
etc.
Of course some of these can be default (like "interactive" or "automatic"), which will be used if no options are specified.
P.S. I'm not native in English, but I think "responce" should be spelled "response"Last edited by kubicle; Jul 05, 2013, 11:35 PM.
- Top
- Bottom
Leave a comment:
-
CLI system updates - little script help...
I know many of us prefer the CLI to do updates - better feedback. I had taken to building aliases for the commands to shorten the typing. The other day I thought "why not a little script to do this?" I am not a programmer but I gave it a go.
Feedback and enhancements desired:
Code:#! /bin/bash # functions function quit { echo "Quiting..." exit } function badinput { echo "Invalid responce, please try again." } function update { echo "Updating..." sudo apt-get update break } function upgrade { echo "Upgrading..." sudo apt-get upgrade break } function dupgrade { echo "Dist-Upgrading..." sudo apt-get dist-upgrade break } function aremove { echo "Auto-removing..." sudo apt-get autoremove } function clean { echo "Cleaning..." sudo apt-get clean } function aclean { echo "Auto-cleaning..." sudo apt-get autoclean } #do it while true; do read -p "Would you like to update your repos? [Y/n/q]: " uanswer case $uanswer in n|N*) echo "Skipping update..." break ;; q|Q*) quit ;; *) update ;; esac done while true; do read -p "Dist-upgrade, Upgrade, Skip or Quit? [D/u/s/q]: " danswer case $danswer in u|U*) upgrade ;; n|N*) echo "Skipping upgrade..." break ;; q|Q*) quit ;; *) dupgrade ;; esac done echo "Final stage: Clean up..." while true; do read -p "Autoremove, Clean, autocLean or Exit script? [a/c/l/E]: " canswer case $canswer in a|A*) aremove ;; c|C*) clean ;; l|L*) aclean ;; *) quit ;; esac done
Thoughts?Tags: None
- Top
- Bottom
Leave a comment: