Tagged Questions
10
votes
3answers
378 views
What does ${1+“$@”} mean in a shell script, and how does it differ from “$@”?
In the Perl documentation, perlrun(1) suggests launching Perl scripts using a bilingual shell/Perl header:
#!/bin/sh
#! -*-perl-*-
eval 'exec perl -x -wS $0 ${1+"$@"}'
if 0;
What does ${1+"$@"} ...
0
votes
3answers
238 views
Prevent init daemon echoing on TTY
Below is an init script which starts/stops a daemon. The daemon is unfortunately printing the parsed packet data (from /home/nuthan/program/server), a socket server written in perl, listening to a ...
1
vote
1answer
186 views
Identify text/ascii files in Linux/Solaris
I have a little project to build bash script that search in the OS ( Linux/Solaris ) the current IP address from files and replace them with other IP address.
The problem is that IP address could be ...
2
votes
5answers
945 views
Perl script, do cd on terminal
In Script to change current directory (cd, pwd)
it is shown how to run a bash script that changes terminal directory.
But how do i run a perl script that runs a bash script that changes terminal ...
0
votes
1answer
228 views
linux + perl + replace any WORD in file with special characters with condition
Example1 work fine when I want to replace OLD_TEXT with NEW_TEXT ( its replace also all special characters as $@^%)(_+`:; etc ..)
example1
export OLD_TEXT='$$OLD_WORD$$'
export ...
1
vote
2answers
437 views
Fetch values from plist file on Linux
I have bash script which was written for OS X and now ported to Linux. I don't have access to the Linux box. The bash script would read values from plist files using the defaults read and PlistBuddy ...
3
votes
2answers
147 views
Bash error message on a mac using Perl
I'm trying to run basic functions on Perl (Mac) but I get the same error message all the time. I managed to run programs like the simple 'hello, world' example. They work fine:
$ perl -w hello.pl
...
4
votes
6answers
246 views
What is the easiest way to check if column A and B values goes both ways with AWK? [closed]
What is the easiest way to check if column A and B values goes both ways?
Output to check:
Mike John
John Mike
Pamela Barbara
Barbara Pamela
Mike Paul
Roger Paul
Desired output
Mike <-> ...
5
votes
3answers
1k views
Find files with same name but different content?
I want to generate a list of files that have:
Same name
Different content
in a directory (including all children directories and content).
How to do? Bash, perl, anything is fine.
So, two ...
1
vote
1answer
489 views
Connect to a remote mysql server with bash php or perl
What is the best and lowest resource way to connect to a remote mysql server (server1.example.com) and execute queries like
INSERT into SERVICES (user, id) ($user, $id)
from server2.example.com?
...
2
votes
2answers
374 views
How can I turn ugly output into pretty, useful information?
How can I turn this ugly output into pretty, useful data?
The output:
/* ---------- TA#box#AbC_p ---------- */
insert_job: TA#box#AbC_p job_type: a
#owner: bob
permission: gx
date_conditions: 1
...
-6
votes
1answer
160 views
Linux: create list of text with multiple operators [closed]
I want to make a list like this:
7785237_770x770_de3b540dc13ed50023d17854513b40aa07e50a6a
732308_770x770_ec5c344c0114011a5306b31142ff9b001813f6d6
...
2
votes
2answers
185 views
perl regex replacing globally when global not selected
I'm using Ubuntu 11.04 and wrote a small script that searches within text files for certain "tokens" and replaces with some a prewritten snippet from a template file of the same name.
The text files ...
4
votes
4answers
527 views
How can I remove a specific string from a file only if there are other lines in the file?
How can I remove a specific string from a file ONLY if there are other lines in the file?
For example, don't touch this file:
cat file.txt
ASDF
but remove "ASDF" from this file:
cat file.txt
ASDF
...
4
votes
1answer
218 views
Passing clicked links in rxvt to a script
I start my browser vimprobable in tabbed like so:
"`tabbed -d > /tmp/tabbed.xid`; vimprobable2 -e `cat /tmp/tabbed.xid`" [1]
I am then able to send all new instances of vimprobable to tabbed (and ...