Bash is a free shell for Unix-like operating systems, from the GNU Project

learn more… | top users | synonyms

3
votes
4answers
841 views

How to list one file in each subdirectory of root folder?

Apologies if this is trivial- but how do list just one file in each subdirectory of my root folder? Linux terminal or MS DOS syntax doesn't matter. I would guess it would be an ls or dir command with ...
1
vote
4answers
38 views

Check which string occurs first in a growing file

I'm running a remote executable which produces a logfile. I want to write a script to check whether the executable is run successfully or encounters an error. The way I can do this is by looking at ...
0
votes
4answers
134 views

how to access homedir by root user

I want to access root user's home directory /root/. However following commands dont lead me to the root directory. sudo -s cd ~ It leads to the home dir of regular user. How to access /root ...
0
votes
4answers
830 views

using awk to make exact matches

i'm just wondering how can we use awk to do exact matches. for eg $ cal 09 09 2009 September 2009 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ...
1
vote
3answers
239 views

Read everything that has been echo'd and 'errored' to terminal window?

I've inherited a complex shell script running on OSX that gets run on a crontab. Within the script I would like to periodically read everything in the terminal window and write it to another file... ...
0
votes
3answers
66 views

Grep for block surrounding an error message

I want to grep for the block of logs around a particular error message. Say I know my log looks like this: [----] I, [2014-04-10T19:12:36.294512 #1910:e93004] INFO -- : Started GET "/ems_infra/new" ...
0
votes
3answers
64 views

Running BASH Script on a Remote Windows Machine from Linux Machine

I am planning to run a BASH script on a remote Windows system from my local Linux machine. For this purpose, I will have to login to Windows machine from the local one and then execute the BASH ...
0
votes
3answers
243 views

Bash - Move those files that contain the string to directory

Task: Create script, that will take 2 arguments: 3.sh <directory> <destination> Search the files in <directory> for substring “moveme” in the file content Move those files that ...
0
votes
3answers
49 views

Matching a sequence of symbols in bash

I would like to list all Fortran 90 files in bash without files ending in _tst.f90. My best try so far is ls -l ../src/*[!_tst].f90 According to Bash reference on pattern matching [!_tst] takes ...
0
votes
3answers
94 views

Listing files, including archive contents

Is there some method to find, from the shell, all files matching a file pattern including those inside archives (specifically: zip archives)? The simulation package "VASP" produces files called ...
0
votes
3answers
247 views

Is there any way to encapsulate bash functions?

I'm writing a simple script script.bash that is supposed to export some variables environment, to use it in my current session I have to source it $ . script.bash script.bash function fun1() { ...
0
votes
3answers
343 views

How do I remotely execute scripts on multiple servers, mix output

Hi I'm looking for a piece of software or some sort of technique that would enable me to do following in one terminal window: Take as input a list of ssh-enabled machines with login, password and ...
0
votes
3answers
153 views

How to mount a Windows shared drive on OS X given a Windows user like this: myserver@mydomain.com

I have a script in OS X which is something like this: tell application "Finder" try mount volume "SMB://myuser:mypwd@myhost/sharedfolder" end try end tell It works fine, but now ...
0
votes
3answers
178 views

Mac Terminal -bash warnings on start

Upon opening a new Terminal window on my Mac, I always get the following message - Last login: Wed xx xxxxx on xxxxx -bash: export: `-s': not a valid identifier -bash: export: ...
0
votes
3answers
2k views

Loop through a directory unix shell programming

Use a for loop to go through the filenames in the directory. In this version, only loop through the filenames that do not have a ".old" extension Inside the loop, rename the file to the new name.
-1
votes
3answers
124 views

What is the terminal I use in OS X Terminal?

I go to OS X Terminal, sometime people just give me the command grep , ls, some people called it is shell script , some people call it unix shell. I also got a term bash shell, Bash command. So, I ...