Tag Info

Hot answers tagged

20

bash (or whatever you use as shell), is the first thing to read any input, and will start interpreting special characters such as ? and *. * gets expanded to whatever matches in the CWD, which means that the asterisk is substituted by said matches. In most cases, this is fairly straght forward, but can lead to some confusing cases from time to time. ...


5

As already stated, the shell expands * so echo receive as arguments whatever the shell find in the current directory. However, note that if the expansion leads to nothing, i.e. in that case if the directory contains no non-hidden files, the * is left unchanged and passed as is to the command called (unless non standard options are used with some shells like ...


4

In Bash, the shell deals with it. You see that if you even try * without echo Note- based on some comments, I would suggest when running * ENTER, to create a directory and use the touch command to make some files, and make sure none of them , or at least make sure the first one alphabetically, is not the name of any script or command in the path. $ * bash: ...


2

You have to add a %1 parameter to get the association to work, e.g., like this (quotes are needed to work with paths having embedded blanks): C:\cygwin64\bin\sh.exe -li "%1" The question was asked before in several places; these may be helpful: How can I associate .sh files with Cygwin? Cygwin/Windows/DOS integration: Tips and Tricks The window will ...


2

alias application=/path/to/start.sh Symlinking would work too. Whether either of this is "best" practice depends on what you want to do.


1

The canonical way to fix this is to add to the user's PATH variable. How to do this depends on the shell used, but for most (non-Csh based shells) usually PATH=$PATH:/dir/that/script/is/in works.


1

With tab-separated files: awk ' BEGIN { FS = OFS = "\t" } NR == FNR {fn[$1] = $4; next} {print $1, $2, $3, ($3 in fn ? fn[$3] : "FALSE"), $4, $5} ' file2.txt file1.txt Query No. Accession Function Name DB EFX03602.1 1006 PHI:1006 HMG-CoA Reductase HMR1 Not_Available EFX00827.1 101 PHI:101 Polyketide synthase ALB1 ...


1

You could try: { foo; echo contents not stored in file; } | bar or (almost the same, but starts a subshell): ( foo; echo contents not stored in file ) | bar Edit: A totally different approach, closer in design to what you were looking for: foo | cat - <(echo additional contents) | bar See "Process substitution" in bash's manual.


1

It seems a work for awk. It allows somehow the use of associative multidimensional arrays. The following bash script should do the work. awk ' { Nb[$1]++;b[$1][Nb[$1]]=$2 } END{ for (i in Nb) { printf("%s ", i); for (j = 1 ; j<=Nb[i]; j++) printf("%ld ", b[i][j]); printf(" \n") ; } ...


1

This function should looks like: callSINGULAR() { /opt/local/bin/Singular -b "$1" } Because the parameter is first, provided to function


1

You can query the color with printf "\e]4;3;?\e\\" which places the response in the keyboard buffer as if you've typed it in the terminal (which is hard to process in shell scripts). Or you can use xtermcontrol --get-color3 which a convenience frontend using this escape sequence.



Only top voted, non community-wiki answers of a minimum length are eligible