Search Results

Search: Posts Made By: strobotta
1,926
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,432
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...
2,650
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,455
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,108
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`
...
45,750
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...
7,837
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,348
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,055
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.
...
6,775
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.
...
677,351
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 03:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy