Search This Blog

Monday, January 31, 2011

/bin/bash^M: bad interpreter: No such file or directory

-bash: ./2_genDB.sh: /bin/bash^M: bad interpreter: No such file or directory

Here is the solution:
http://www.linuxforums.org/forum/red-hat-fedora-linux/65469-bad-interpreter-no-such-file-directory.html

Quote:
#!/usr/bin/perl

die "Usage: $0 < files >\n" unless @ARGV;

for $file (@ARGV)
{
    open IN, $file or die "$0: Cannot open $file for input!\n";

    my @lines = <IN>;

    close IN;
    open OUT, "> $file" or die "$0: Cannot open $file for output!\n";

    s/\r$// for @lines;
    print OUT for @lines;
}

Save this file as fix_m.pl

run perl fix_m.pl yourshell.sh

check linux shell version

gregg@server:/opt/de$ echo $SHELL
/bin/bash

mysqldump no data , mysqldump a table with data

1, Dump whole DB schema
$ mysqldump --no-data -u mysqluser -pMysql_DB_PW api > api.mysql

2, Dump a table data from DB
$ mysqldump  -u mysqluser -pMysql_DB_PW  api_DB a_table  > db_table.mysql