shell

Add dependency to existing pom.xml via shell

Is there a way to add dependencies to an existing pom.xml via shell script? Something like: mvn dependency:add -DgroupID=com.acme -DartifactId=project [Update] Clarified that I want to add to an existing pom ...

Python 3 online interpreter / shell

Does anyone know about an online interpreter like http://codepad.org/ or http://try-python.mired.org/ with Python 3? ...

Difference between piping a file to sh and calling a shell file

This is what was trying to do: $ wget -qO- www.example.com/script.sh | sh which quietly downloads the script and prints it to stdout which is then piped to sh. This unfortunately doesn't quite work, failing to wait for user input at various points, aswell as a few syntax errors. This is what actually works: $ wget -qOscript www.exam...

bash alias not able to create

I tried to create an alias in bash but am not able to do. alias bundle-vendor= 'bundle install vendor --disable-shared-gems' ...

Can Ruby access output from shell commands as it appears?

My Ruby script is running a shell command and parsing the output from it. However, it seems the command is first executed and output saved in an array. I would like to be able to access the output lines in real time just as they are printed. I've played around with threads, but haven't got it to work. Any suggestions? ...

zsh alias within function

Good morning, In zshell I have an alias as follows: alias foo='echo FooBar!' Which of course works fine. I have a function wherein I'm trying to actually 'execute' the alias, where it doesn't. foo_fun () { echo "About to foo!" `$foo` $foo eval $foo eval `$foo` echo "Just food...wait what?" } I'm having a b...

Linux: shell builtin string matching

I am trying to become more familiar with using the builtin string matching stuff available in shells in linux. I came across this guys posting, and he showed an example a="abc|def" echo ${a#*|} # will yield "def" echo ${a%|*} # will yield "abc" I tried it out and it does what its advertised to do, but I don't understand what the...

Listing time every second as a Bash script

Hello all, first time here as I've finally started to learn programming. Anyway, I'm just trying to print the time in nanoseconds every second here, and I have this: #!/usr/bin/env bash while true; do date=(date +%N) ; echo $date ; sleep 1 ; done Now, that simply yields a string of date's, which isn't what I want. What is wrong? ...

How to make shell output redirect (>) write while script is still running?

I wrote a short script that never terminates. This script continuously generates output that I have to check on every now and then. I'm running it on a lab computer through SSH, and redirecting the output to a file in my public_html folder on that machine. python script.py > ~/public_html/results.txt However, the results don't show up...

How to edit doxygen.config from shell script?

Hi, I tried using Apple's shell script to automate doc set creation with every build (and loading that in XCode) - http://developer.apple.com/tools/creatingdocsetswithdoxygen.html but found that it had some bugs. Firstly it's not updating the entries in doxygen.config, perhaps one needs to put the settings in the exact hierarchy as it a...

Correct way to create a shell like environment in python?

I'm trying to create a shell like environment, where a user is presented with ">>>" and can type in any of a number of pre-defined commands. However, the only way I can think of implementing this is with a dictionary mapping commands->code and python's "exec". Is there a more correct way of doing this? ...

What is the difference between $@ and $* in shell scripts ?

In shell scripts, what is the difference between $@ and $* ? Which one is the preferred way to get the script arguments ? Are there differences between the different shell interpreters about this ? ...

How to define an alias in fish shell?

I would like to define some aliases in fish. Apparently it should be possible to define them in ~/.config/fish/functions but they don't get auto loaded when I restart the shell. Any ideas? p.s. if anyone is using or has used fish in the past I'd be interested to hear your comments as to whether it offers anything that bash does no...

How to automate video capture for a game walkthrough with scripting?

Hi, I would like to know how can I do an automated video capture for a game walk through on a game such as Second life, etc? I am using camstudio to capture the video. Using windows, I wonder if shell scripting, or otherwise can do the job with camstudio? Thank you. ...

wscript.shell running file with space in path with PHP

I was trying to use wscript.shell through COM objects with php to pass some cmd commands to cURL library (the DOS version). here is what I use to perform this task: function windExec($cmd,$mode=''){ // Setup the command to run from "run" $cmdline = "cmd /C $cmd"; // set-up the output and mode if ($mode=='FG'){ $...

Get file name before the extension

I have some files in the same directory (in UNIX filesystem) that looks like: a.txt.name b.xml.name c.properties.name a.txt.name2 b.xml.name2 c.properties.name2 How do I get the string before the name or name2 part using some shell command? ie. the a.txt, b.xml, c.properties part? ...

script to generate crontab syntax from clean human-friendly input?

Is there a tool or scripting language that will allow me to create a crontab-syntax output after supplying a human-friendly specification or initialization file? For example: when: every 2 hours what: system('/path/to/flush_system_logs') when: 4:45pm every Wednesday what: system('/path/to/system_janitor_script') I would like to ...

Create database in Shell Script - convert from PHP

I have the following PHP code that i use to create a database, a user, and grant permissions to the user: $con = mysql_connect("IP.ADDRESS","user","pass"); mysql_query("CREATE DATABASE ".$dbuser."",$con)or die(mysql_error()); mysql_query("grant all on ".$dbuser.".* to ".$dbname." identified by '".$dbpass."'",$con) or die(mysql_error()...

output of one command is argument of another

Is there any way to fit in 1 line using the pipes the following: output of sha1sum $(xpi) | grep -Eow '^[^ ]+' goes instead of 456 sed 's/@version@/456/' input.txt > output.txt ...

Accessing variable from ARGV

I'm writing a cPanel postwwwact script, if you're not familiar with the script its run after a new account is created. it relies on the user account variable being passed to the script which i then use for various things (creating databases etc). However, I can't seem to find the right way to access the variable i want. I'm not that good...