I’m using Python with -c to execute a one-liner loop, i.e.: python -c "for r in range(10): print 'rob'" This works fine. However, if I import a module before...
Closed. This question is opinion-based. It is not currently accepting answers. Closed 4 years ago. Locked. This question and its answers are locked because the question is off-topic but...
I want to list only the directories in specified path (ls doesn’t have such option). Also, can this be done with a single line command? 22 Answers 22
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...
I am trying to run this script in PowerShell. I have saved the below script as ps.ps1 on my desktop. $query = "SELECT * FROM Win32_DeviceChangeEvent WHERE EventType =...
I need to create a script that automatically inputs a password to OpenSSH ssh client. Let’s say I need to SSH into myname@somehost with the password a1234b. I’ve already...
I normally run multiple commands with something like this: sleep 2 && sleep 3 or sleep 2 ; sleep 3 but what if I want to run them both...
I am looking for a way to clean up the mess when my top-level script exits. Especially if I want to use set -e, I wish the background process...
I have the feeling that I’m missing the obvious, but have not succeeded with man [curl|wget] or google (“http” makes such a bad search term). I’m looking for a...
I know how to redirect stdout to a file: exec > foo.log echo test this will put the ‘test’ into the foo.log file. Now I want to redirect the...