Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Articles by Madhavan Kumar
Switch buffer to the file path in current cursor position
My .emacs file contains multiple file names as, (load "~/.emacs.d/others/keymaps.el") (load "~/.emacs.d/others/py.el") (load "~/.emacs.d/others/web.el") Is there a way any library, gives way for me to keep the cursor in the middle of file path and jump straight to the file content on pressing a shortcut. (load "~/.emacs.d/others!!(cursor here)/py.el") When the line cursor is in the middle of a file path, it must switch buffer to ~/.emacs.d/others/py.el
Search and replace control characters (^@, ^M, ^I....) in vi
It's not that did that. Although you type command lines in shells with spaces between the arguments, command lines are actually discrete sequences of strings internally, not one long space-separated string. The shell separated the command line into individual argument strings before the command was launched. In C, strings are terminated with NUL characters and those are shown as . In order to type those characters, you must prefix them with - for literal next character.
for loop in bash lists dot and double dot folders
for f in ~/common/.*; do echo $f done The entries listed are, /home/sk/common/. #undesired /home/sk/common/.. #undesired /home/sk/common/.aliasrc And i am putting a ugly hack to skip processing . and .. to avoid this, if [[ $f == '/home/sk/common/.' || $f == '/home/sk/common/..' ]]; then true else --do the ops fi Is there a shell option that will hide the dotted folders? I am facing this problem with ls -a as well.
Control.Category, what does >>> and <<< mean?
As Hackage and/or Hoogle will tell you, Observe that the latter is actually the same as or, in its form, specialised to the Hask category of functions, So, and simply compose functions, or more generally morphisms/arrows. composes in the same direction as the familiar , while flips the arguments so that “data flows from left to right”. Now, what arrow composition means, for categories other than Hask, depends of course on the category.
View only the new entries in a growing log file
tail -f x.log I use this command to see a growing log file in the command prompt. I am interested only in seeing the log lines that are written to the file after running tail -f and not interested in the logs that were written to the file before doing tail -f. But tail -f command on start, takes the last 10 lines and displays it. This confuses me, at times if these logs are freshly generated (or) they are old logs? So, how can i customize tail -f to output only the new entries?
rm $ENV_VAR/* deletes the entire root
[ -z "$PROJECT_HOME" ] || rm -r "$PROJECT_HOME"/* This will also catch the case where PROJECT_HOME is set but doesn't contain anything. Example: 1) This will delete pretty much everything you can delete on your system (barring dotfiles inside / (there aren't usually any)): set -u PROJECT_HOME= rm -r "$PROJECT_HOME"/* 2) This won't do anything: PROJECT_HOME= [ -z "$PROJECT_HOME" ] || rm -r "$PROJECT_HOME"/*
Issue an error when using empty shell variables
[ -z "$PROJECT_HOME" ] || rm -r "$PROJECT_HOME"/* This will also catch the case where PROJECT_HOME is set but doesn't contain anything.
Echo command with AND operator doesn't exit
Your confusion stems from the fact that in many popular languages, especially C-based ones, sequences are stopped being evaluated when 0 is encountered because only 0 is considered and everything else is . In Bash, however, it's not the case. By convention, in POSIX systems return code 0 is considered (there was no error, so nothing is returned) and a non-zero return code is considered .
Show More
loading
Actions
Is this you?
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.Get in touch with Madhavan
Contact Madhavan, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack