When I run the .cmd file in the cluster I am getting an error message as
/bin/bash: : No such file or directory
The below is the PBS script in the .cmd file
#! /bin/bash
#PBS -o logfile.log
#PBS -e errorfile.err
#PBS -l cput=740:00:00
#PBS -l select=2:ncpus=8
tpdir=`echo $PBS_JOBID | cut -f 1 -d .`
tempdir=$HOME/work/job$tpdir
mkdir -p $tempdir
cd $tempdir
cp -R $PBS_O_WORKDIR/* .
fluent 2ddp -g -t16 -pib -cnf=$PBS_NODEFILE -ssh -i srik.jou >> out
mv ../job$tpdir $PBS_O_WORKDIR/.
Please help me to figure out the problem.
I have a bash script executing on an AIX server to a windows share directory to update a windows text file. Most of the file is edited as expected but I have 3 issues that I am not sure how to resolve.
1. Windows text file contains a double backslash (\\) and the \\ is being written back as a single \ which corrupts the file.
2. I am not getting the last line of text in the file written back out.
3. Some lines of text are not written back out completely.
Here is a snippet of my bash script:
cp $Directory/Somefile $Directory/Somefile.$(date +'%Y%m%d')
cat /dev/null > ${HOME}/temp.out
while read -r inpLine; do
patternFound=n
echo ${inpLine} | grep -q 'SOMEPATTERN='
if [ $? = 0 ]; then
patternFound=y
echo "##${inpLine}" >> ${HOME}/temp.out
echo "SOMEPATTERN=newValue" >> ${HOME}/temp.out
fi
if [ ${patternFound} = "n" ]; then
echo ${inpLine} >> ${HOME}/temp.out
fi
done < $Directory/Somefile
mv ${HOME}/temp.out $Directory/Somefile
This is my script and the syntax to run this script is give ip and next will be the file or script you want to perform on remote server
#!/bin/bash
# The private key used to identify this machine
IDENTITY_KEY=/home/adnew.pem
syntax()
{
echo "Syntax: Ec2.sh server_ip scriptFile]"
echo "For example: ./Ec2.sh server_ip scriptFile"
exit 1
}
if [ $# -ne 2 ]
then
echo not enough arguments
syntax
fi
echo "Running script $2 on $1"
ssh -ttq -i $IDENTITY_KEY ec2-user@$1 sudo -i 'bash -s' < $2
exit
exit
echo "Done"
on script file i have give for testing
touch /root/test
ls /root/test
exit
exit
it makes the file but do not show the ls output by giving error
tcgetattr: Inappropriate ioctl for device
exit
what I have to do ??
hi
I try to assign return from a _error_handler_function to a variable
this is just a test( dummy test ) not a really case
#!/bin/bash
logfile="/dev/shm/log.err"
exec 2>$logfile
_err_handler(){
v=$(cat $logfile|grep dummy|wc -l);
rm $logfile
echo $v
}
trap _err_handler ERR
x=$(dummy);
echo "x value is $x "
z=$(notrap)
echo "z value is $z"
expected output :
bash-4.1$ sh test2.sh
x value is 1
z value is 0
what is wrong here and how should I fix?
thanks in advance
I know that this question has been asked a number of times in the past, but I still can't find an answer. I typed in the following command in my terminal: cd/Home/Harold/Pictures (and I know all of these exist because I can see them) and I get the following response: Bash: cd/Home/Harold/Pictures: no such file or directory. Any ideas?
Hi folks,
I have a very basic question for you if you don't mind. Whenever I open a terminal, I get this
Code:
bash: /etc/profile.d/touchpad.sh: No such file or directory
followed by the usual prompt.
A few weeks ago I made a script called touchpad.sh, which would run whenever I opened a terminal. In the end, I deleted it because it wasn't doing what I wanted it to do. But some file is clearly still pointing to it. I've searched high and low for the source of this error, i.e. some reference to touchpad.sh, but I cannot find it. I've looked in ~/.bashrc ~/.profile and a few other places I can't remember offhand that I found on the Internet. Can anyone tell me where this reference is most likely to be? While it doesn't cause any problems and I can still use the terminal without a problem, it's a bit annoying and considering the amount of time I've spent trying to solve this problem, I'd be most grateful if someone point me in the right direction.
I'm running Sparky Linux (Debian Jessie) 64-bit (XFCE install) with Enlightenment Desktop on Lenovo T420.
Thank you in advance.
Hi,
I have Redhat 5.3 running on my machine. But when I am login through putty it gives me below error.
Without running any grep command I get this error on login and the grep command doesn't work.
login as: root
root@IP's password:
Last login: Mon Feb 16 15:27:55 2015 from IP
-bash: /bin/egrep: cannot execute binary file
-bash: /bin/egrep: cannot execute binary file
-bash: /bin/egrep: cannot execute binary file
-bash: /bin/grep: cannot execute binary file
-bash: /bin/grep: cannot execute binary file
[root@bkpdrill ~]# grep MemTotal /proc/meminfo
-bash: /bin/grep: cannot execute binary file
Hello,
I am setting up a linux server for gaming and I am using a script to update the files automatically and create a folder with a certain name.
Code:
# !/bin/bash
# A convenience function, to save us some work
update_server() {
# Read the app id and the directory into a variable
APP_ID=$1
DIR=$2
# Create the directory ( if it does not exist already )
if [ ! -d "$HOME/$DIR" ]; then
mkdir -p "$HOME/$DIR"
fi
# Uh-oh, it looks like we still have no directory. Report an error.
if [ ! -d "$HOME/$DIR" ]; then
# Describe what went wrong
echo "ERROR! Cannot create directory $HOME/$DIR!"
# Exit with status code 1 ( which indicates an error )
exit 1
fi
# Call SteamCMD with the app ID we provided and tell it to install
./bin/steamcmd.sh +login anonymous +force_install_dir "$HOME/$DIR" +app_update $APP_ID validate +quit
}
# Now the script actually runs update_server ( which we just declared above ) with the id of the application ( 4020 is Garry's Mod ) and the name of the directory we want the server to be hosted from:
update_server 4020 "gmodserver"
exit 0
When I run this script, it creates 2 folders on my server : gmodserver and gmodserver? There is no files downloaded in gmodserver. All the files are downloaded in gmodserver?
I looked for a few hours on how to solve this problem but I have no idea what the added ? might be so I am lost as to what to look for. Could you help me on figuring this out?
Thank you.
edit : I am using ubuntu 15.04 x64 if it makes a difference.
I'm running a bash script on a Raspberry Pi to control LED pixels. I'm stuck on a basic copy command.
I have a variable called nexttemp which contains the string B_254_TieDyeKaleidoscope.fseq
That file, in the same directory, is a large binary file that I'm trying to copy to a file called MasterFseq.fseq
If I do a
cp nexttemp MasterFseq.fseq
then MasterFseq.fseq contains the B_254_TieDyeKaleidoscope.fseq file name.
I want instead to have copied the binary file to MasterFseq.fseq.
It's my understanding that a $nexttemp will point to the binary file and not the name of it but when I do a
cp $nexttemp MasterFseq.fseq
the $nexttemp is thrown away and I'm told there is no destination file name, eg.
root@FPP:/home/pi/media/sequences# echo cp $nexttemp MasterFseq.fseq
+ echo cp MasterFseq.fseq
cp MasterFseq.fseq
How do I get the binaray file, which is named in nexttemp, copied to MasterFseq.fseq?
John
Hi Everyone,
I need some help on my bash script, I'm trying to rename a certain line in a file which might be 1 or more.
IDXCOUNT=`grep -c 'index .* on ' $FILENAME`;
for n in $(eval echo {1..$IDXCOUNT});
do
timestamp=$(date +"%s");
echo "Renaming index idx_$timestamp..";
if [ $n -eq 1 ]; then
sed -i "0,/^index [^)]* on /s/index idx_$timestamp on /" $FILENAME;
My problem is, if the sed target is 2 or more it will generate an idx_$timestamp that will cause duplicate index value when the script finish. My goal is to have the script recognize that when there are multiple index in the file, it will try to rename it one by one.
I'm new to bash so I'm not sure if I explained my issue well but I will appreciate any help!!
Thanks!
hello,
I am trying to rename the file by adding .txt extension and also
before renaming, I want to replace . in file with _
right now file looks like this mdm.201504021628
after execution of my script file name should be mdm_201504021628.txt
#!bin/bash
//reading all files from directory
files=$(hadoop fs
-ls /dl/data/landing/hivedb/lnd_attunity_kpi_db_backup/auth_master |
awk '!/^d/ {print $8}')
for f in $files; do
//using sed to replace . with _ and then feeding to hadoop fs command
sed 's/./\_/g' $f | hadoop fs -mv $f $f.txt
done
Thanks for your help in advance.