Search Results

Search: Posts Made By: strobotta
2,082
Posted By strobotta
argument substitution in rsync
Hi,

in a bash shell script I have a rsync command as follows:

rsync -av \
--exclude ".svn" \
--exclude ".cache" \
$src $dest


Because I need the command twice I thought...
15,855
Posted By strobotta
Parameter substitution with alias
Hello,

in my .bashrc I tried to setup some aliases.
alias scp_cmd="scp -P 8888 $1 me@somehost:."
is supposed to copy a local file to somehost via scp. However it seems that the command line...
3,135
Posted By strobotta
the double quotes will replace the variable by...
the double quotes will replace the variable by it's value. This will work fine for "Hello $world". As soon as there are many worlds and you refer to one by "Hello $world[0]" PHP will try to...
6,625
Posted By strobotta
possible solution
a possible solution could be:

#!/bin/bash

if [ -z $1 ]; then
exit;
fi

current_directory=`pwd`

# 2nd call of the script
if [ "$1" == "$current_directory" ]; then
ls -l
# first...
2,225
Posted By strobotta
rather printing the output, redirect it to a file...
rather printing the output, redirect it to a file i.e. add to the line above:
> /tmp/file_count.$$

Then on Bash (sorry no Korn shell here available):

lines=`cat /tmp/file_count.$$ | wc -l`
...
46,767
Posted By strobotta
Check out...
Check out http://tldp.org/LDP/abs/html/here-docs.html

In exaple 18-2 a file is opend with vi and some lines are added. You could check for the last } in your file and then use the O to insert...
8,288
Posted By strobotta
try hostname --ip-address At least this works...
try hostname --ip-address
At least this works for a fixed IP address on a Linux box.

on a FreeBSD box you can also try ifconfig There you still have to parse output according to your needs.
6,661
Posted By strobotta
don't forget to put a backslash before the @. ...
don't forget to put a backslash before the @.

#!/usr/bin/perl
system ("ssh user\@server $some_command");
6,160
Posted By strobotta
what do you mean by connecting PHP with shell...
what do you mean by connecting PHP with shell scripts?

in PHP you can use shell scripts/single commands by using
exec
passthru
system

see http://php.net for more details on these commands.
...
7,016
Posted By strobotta
The following should work: diff old_file...
The following should work:
diff old_file new_file | grep ">" | cut -b 3- > new_records.txt
grep entries that are in the newer file only, and cut the first two leading chars that diff outputs.
...
691,923
Posted By strobotta
sftp with lftp
Today I had the same problem, that I need to do an sftp connection for a script that will not run in interactive mode.


#!/bin/sh

HOST=XX.XXXX.XXX
USER=yourusername
PASS=yourpassword

echo...
Showing results 1 to 11 of 11

 
All times are GMT -4. The time now is 09:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy