We've finally moved our websites to a decent host, and for the first time we have Shell Access.
I know very little about using Linux, I can navigate through the file system, read files with Vim and I'm aware of the man command, and I have been able to work out solutions to problems as they show up (eventually), but I know I'm unaware of...
As a LAMP developer considering moving to a .Net IIS platform, one of my concerns is the loss of productivity due to lack of shell... Has anyone else had this experience? Is there possibly a Linux shell equivalent for Windows?
...
Can anyone explain this behavior?
Running:
#!/bin/shecho "hello world" | read var1 var2echo $var1echo $var2
results in nothing being ouput, while:
#!/bin/shecho "hello world" > test.fileread var1 var2 < test.fileecho $var1echo $var2
produces the expected output:
helloworld
Shouldn't the pipe do in one step what the redirection to t...
Is there a better windows command line shell other than cmd which has better copy paste between Windows' windows and console windows?
...
I need to do date arithmetic in Unix shell scripts that I use to control the execution of third party programs.
I'm using a function to increment a day and another to decrement:
IncrementaDia(){echo $1 | awk 'BEGIN { diasDelMes[1] = 31 diasDelMes[2] = 28 diasDelMes[3] = 31 diasDelMes[4] = 30 diasDel...
Given an absolute or relative path (in a Unix-like system), I would like to determine the full path of the target after resolving any intermediate symlinks. Bonus points for also resolving ~username notation at the same time.
If the target is a directory, it might be possible to chdir() into the directory and then call getcwd(), but I r...
Windows PowerShell came out last year and got great reviews from many .net bloggers (Hanselman comes to mind). It seemed to be touted as a great new utility that somehow made everything that you would ever do on the command line easier, and integrated with .Net. However, the more I read about it, the more it seems to be a tool that is gr...
I can display and select a single file in windows explorer like this:
explorer.exe /select, "c:\path\to\file.txt"
However, I can't work out how to select more than one file. None of the permutations of select I've tried work. Help!
Note: I looked at these pages for docs, neither helped.
http://support.microsoft.com/kb/314853
http:/...
I used to demote my user account so that it had no admin priveleges and used a 'sudo-like' trick where you create a shortcut to IE6 and enabled the 'Run with different credentials' option to open a shell window as local admin so I could install, uninstall things etc.
When I upgraded to IE7 this stopped working - IE7 launches Windows Exp...
I was looking at http://tldp.org/LDP/abs/html/why-shell.html and was struck by:
When not to use shell scripts
...
Mission-critical applications upon which you are betting the future of the company
Why not?
...
I'm looking for shell scripts files installed on my system, but find doesn't work:
$ find /usr -name *.sh
But I know there are a ton of scripts out there. For instance:
$ ls /usr/local/lib/*.sh
/usr/local/lib/tclConfig.sh
/usr/local/lib/tkConfig.sh
Why doesn't find work?
...
I ended up writing a quick little script for this in Python, but I was wondering if there was a utility you could feed text into which would prepend each line with some text -- in my specific case, a timestamp. Ideally, the use would be something like:
$ cat somefile.txt | prepend-timestamp
(Before you answer sed, I tried this:
$ ca...
I have a couple of files containing a value in each line
EDIT: Oops... I figured out the answer to this question while in the midst of writing the post and didn't realize I had posted it by mistake in its incomplete state.
I was trying to do:
paste -d ',' file1 file2 file 3 file 4 > file5.csv
and was getting a weird output. I later ...
When I do:
$ find /
It searches the entire system. How do I prevent that?
(This question comes from an "answer" to another question.)
...
On the UNIX bash shell (specifically Mac OS X Leopard) what would be the simplest way to copy every file having a specific extension from a folder hierarchy (including subdirectories) to the same destination folder (without subfolders)?
Obviously there is the problem of having duplicates in the source hierarchy. I wouldn't mind if they ...
Sometimes I need to quickly extract some arbitrary data from XML files to put into a CSV format. What's your best practices for doing this in the Unix terminal? I would love some code examples, so for instance how can I get the following problem solved?
Example XML input:
<root>
<myel name="Foo" />
<myel name="Bar" />
</root>
My desi...
When I try to use an ssh command in a shell script, the command just sits there. Do you have an example of how to use ssh in a shell script?
...
Hey!
I'm looking for a way to redirect all the stderr streams in interactive bash (ideally to its calling parent process).
I don't want to redirect stderr stream from each individual command, which I could do by appending 2> a_file to each command.
By default, these stderr streams are redirected to the stdout of an interactive bash. I...
Terminals and shells are very powerful but can be complicated to learn, especially to get the best out of them. Does anyone know of a more GUI based command shell that helps a user or displays answers in a more friendly way? I'm aware of IPython, but even the syntax of that is somewhat convoluted, although it's a step in the right direct...
When using os.system() it's often necessary to escape filenames and other arguments passed as parameters to commands. How can I do this? Preferably something that would work on multiple operating systems/shells but in particular for bash.
I'm currently doing the following, but am sure there must be a library function for this, or at l...