I am trying to setup my new laptop’s development environment. After install zsh I am constantly getting error deactivate:unset:1: no such hash table element: pydoc Please help. I have following simple aliases in my zshrc: Answer You can see virtualenv pr on github. or you can change deactivate () function. change unset -f pydoc to unset -f pydoc >/dev/null 2>&1
Tag: unix
check if a file is jpeg format using shell script
I know I can use file pic.jpg to get the file type, but how do I write an if statement to check it in a shell script? E.g. (pseudo code): Answer Try (assumes Bash v3.0+, using =~, the regex-matching operator): If you want to match file’s output more closely: This will only match if the output starts with ‘JPEG’, followed
How does/frequent unix tee command write stdout terminal output to file? if the output is too big
I am redirecting some tool stdout to tee command so that current progress can be seen on terminal as well as in the log file Here is the code snippet where I am running tool and its stdout is fed to tee command and this code snippet is written from tcl script. I can see current real time progress on
Parsing parameters with zparseopts, but from within a sourced script
I have a zsh script myscr.zsh, which sources another script zparse.zsh, like this: zparse.zsh expects a variable number of parameters, which do NOT need to be parsed using zparseopt, but zparse.zsh should – among other things – parse the positional parameters passed to mysrc.zsh. This is tricky, since mysrc.zsh has its own copy of $, which is different from the
zsh parameter expansion syntax: combining default value and conversion to upper case
In a zsh script, outputs the value of the variable X, or 4711 if there is none. outputs the value of the variable X, converted to upper case. I wonder, whether there is a way to combine the two, i.e. to have the effect of without introducing an auxiliary variable. Answer From man zshexpn: If a `${…}` type parameter expression
Unzipping bz2 file
I have the following command to open a tbz file: The compressed file is about 15 GB and when it is expanded it is about 500GB or so. This operation on an ec2-4x-large operation takes roughly 1h40m. Is there a way to optimize this operation? What would be the fastest way to do the above operation? Answer A couple possibilities
Unix cat command problems [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question
Find command with size and time and sorted by timestamp
I have the following folder setup for example I need to recursively list them with file size, modification time and sorted by modification time recent first. I have tried the below without size… Any pointers? Answer %T+ – modification time (and date) %s – size %p – path of file
Paste header line in multiple tsv (tab separated) files
I have multiple .tsv files named as choochoo1.tsv, choochoo2.tsv, … choochoo(nth).tsv files. I also have a main.tsv file. I want to extract the header line in main.tsv and paste over all choochoo(nth).tsv files. Please note that there are other .tsv files in the directory that I don’t want to change or paste header, so I can’t do *.tsv and select
split text file (Genome data) based on column values keeping header line
I have a big genome data file (.txt) in the format below. I would like to split it based on chromosome column chr1, chr2..chrX,chrY and so forth keeping the header line in all splitted files. How can I do this using unix/linux command? genome data result Answer Is this data for the human genome (i.e. always 46 chromosomes)? If so,