Learning bash?
I am currently learning java. But I always see mentioned that you should learn one programming language a year. So my question is it ok to learn bash with java or should I wait a year before I tackle it? ...
I am currently learning java. But I always see mentioned that you should learn one programming language a year. So my question is it ok to learn bash with java or should I wait a year before I tackle it? ...
I want to apply the following "awk" command on files with extension "*.txt" awk '$4 ~ /NM/{ sum += $2 } END{ print sum }' But why this command doesn't work: for i in *.txt do echo awk '$4 ~ /NM/{ sum += $2 } END{ print sum }' $i; done Normally, awk '$4 ~ /NM/{ sum += $2 } END{ print sum }' file1.txt would work. ...
bash, bat, whatever... What is your favourite command line hyperproductivity trick? ...
I often have to login to one of several servers and go to one of several directories on those machines. Currently I do something of this sort: localhost ~]$ ssh somehost Welcome to somehost! somehost ~]$ cd /some/directory/somewhere/named/Foo somehost Foo]$ I have scripts that can determine which host and which directory I need t...
Can someone please give me a recursive command that will go through a directory and make all normal files permission 644 and all sub directories 755? I am really getting tired of doing this manually every time I have to install something on my host. I don't know enough BASH (Shell?) command to do this. ...
If I have a BASH variable: Exclude="somefile.txt anotherfile.txt" How can I get the contents of a directory but exclude the above to files in the listing? I want to be able to do something like: Files= #some command here someprogram ${Files} someprogram should be given all of the files in a particular directory, except for those i...
Dear all, I have a directories that look like this fool@brat:/mydir/ucsc_mm8> tar -xvf *.tar 1/chr1.fa.masked 1/chr1_random.fa.masked 2/chr2.fa.masked 3/chr3.fa.masked 4/chr4.fa.masked 5/chr5.fa.masked 5/chr5_random.fa.masked 19/chr19.fa.masked Un/chrUn_random.fa.masked What I want to do is to move out all the "*.masked" files in th...
I want to get a list of folders at the current level (not including their subfolders) and simply print the folder name and a count of the number of files in the folder (preferably filtering to *.jpg if possible). Is this possible in the standard bash shell? ls -l prints about everything but the file count :) ...
I have pictures from Picture_1.png to Picture_77.png in my Desktop. I am now at a folder called Pictures in terminal. I would like to move the pictures to the folder where I am at the moment. I tried the following code unsuccessfully mv Picture_[1-77].png I am not sure what I should add for the target folder because I am at the targ...
The following code does not work scp /home/username/public_html/site/pictures/* myUsernameAtMyMac@myIpAddress:/home/Masi/Desktop/ I have "Allow only essential services" in my Mac's firewall. How can you solve the problem? [edit] I get the following error after I have "Remote Login" in the list of allowed services. I also allowed "A...
How can I put .Txt file A at the end of .Txt file B in terminal without opening the files? ...
In a Windows command script, one can determine the directory path of the currently executing script using %~dp0. For example: @echo Running from %~dp0 What would be the equivalent in a BASH script? ...
If I have an XCF file (or any other supported by Gimp) how can I convert it to, for example, PNG for display or further processing? ...
When I login to a sun box: SunOS domain.com 5.8 Generic_117350-57 sun4u sparc SUNW,Sun-Fire-V240 I start in the sh shell: SHELL=/bin/sh I type bash to start a bash shell, then have to type . .bash_profile to load my profile. Is there a way it can be set to automatically load the profile? ...
Hi guys, could u help me out? I run this on cygwin as ./test.sh and I get unexpected end of file on line 51. Any thoughts? Thx in advance LAST EDIT: final version 'runnin on CygWin, the problem was with the line break, CrLf instead Lf. #!/bin/sh ################################################## ## USAGE ##############################...
Scenario: You are doing your daily Bash shell stuff. You want to run a previous command so you type: history | grep foocommand Then you get a list of all the foocommand stuff you did for however long your history has kept track, in a list like so: 585 foocommand --baz --bleet 750 foocommand | grep quux 987 history grep | fooco...
Hi all. I've been fighting with crontab recently because in Intrepid the gconftool uses a dbus backend, and that means that when used from crontab it doesn't work. To make it work I have had to export the relevant environment variables when I log in so that it finds the dbus session address when the cron comes to run. Out of curiosity...
I need to make files called from File1, File2, ... to File99. I tried the following unsuccessfully cat test > {File1 .. File99} The command without the word File did not work. ...
I've got a noisy python script that I want to silence by directing its stderr output to /dev/null (using bash BTW). Like so: python -u parse.py 1> /tmp/output3.txt 2> /dev/null but it quickly exits prematurely. Hmm. I can't see the traceback because of course that goes out with stderr. It runs noisily and normally if I don't direct ...
I want to redirect both stdout and stderr of a process to a single file. How do I do that in bash? ...