Skip to main content

All Questions

Tagged with
4 votes
2 answers
4k views

bash script.sh vs ./script.sh vs #shebang

Assuming i am in a bash shell now and i execute the following [me@server]$ bash script.sh q1) Is a new child bash process created to execute the script ? If i do a [me@server]$ ./script.sh q2) ...
Noob's user avatar
  • 1,625
1 vote
1 answer
5k views

Error with command cut: the delimiter must be a single character

I am trying to run this command from console: # HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1` But got this error: Try `cut --...
ReynierPM's user avatar
  • 385
4 votes
1 answer
651 views

What does chmod 7760 <directory> do in CentOS 7 bash?

I typed the command chmod 7760 by accident. I meant to type chmod 770 and now I'm curious what the first command did exactly. After typing chmod 7760 , I typed ls -Al and the directory name was ...
Jamal McTravis's user avatar
0 votes
1 answer
2k views

How do I run Asterisk as user other than root?

I compiled Asterisk 11 from source as user root on CentOS. Now I want Asterisk to run as user asterisk group asterisk. I have uncommented AST_USER="asterisk" AST_GROUP="asterisk" in /etc/sysconfig/...
Nacarone's user avatar
2 votes
1 answer
2k views

Prompt for values until press ENTER key with empty value

I'm working in a bash script for automatize some tasks. This is what I have done until now: #!/usr/bin/env bash PS3='Please enter your choice: ' options=("Create new group" "Add users to group" "...
ReynierPM's user avatar
  • 385
0 votes
1 answer
376 views

CentOS bashrc function to email on login

I've a system setup where an email is sent on a user login (line from .bashrc): printf "user details, ip etc" | mail -s "[LOGIN NOTICE] `hostname` - `whoami`" <admin>@<domain>.co.uk ...
fir3x's user avatar
  • 11
1 vote
3 answers
26k views

Allowing another user to execute program?

I want to allow a particular user to execute a compiled program in my directory. I got his username from cat /etc/passwd. The executable does not write any file but reads a few and gives output on the ...
aatish's user avatar
  • 113
0 votes
1 answer
193 views

Release control from init.d script centos

I am using logstash-forwarder and starting it inside its init script with the command: /opt/logstash-forwarder/bin/logstash-forwarder -config=/etc/logstash-forwarder -spool-size 100 This command ...
girlcoder's user avatar
  • 133
1 vote
1 answer
3k views

echo "something" > file not working when sh script is being executed by remote PHP server

I've got a web-server with my hardcoded webpanel for Source server management and I've got my VPS on CentOS which doesn't really want to execute sh script when asked from remote server. Web-server ...
Josh's user avatar
  • 11
0 votes
1 answer
172 views

CentOS : Removed /root

I have been doing experiments with CentOS and now I am in a situation. I have added an user by mentioning his home directory as /root and then I did userdel -rf <username> So its does the job ...
shekhar's user avatar
  • 784
1 vote
2 answers
5k views

Is it possible to run a dialog/whiptail script in one TTY from another?

The origin of this question, for me, is being able to run a whiptail command in a %pre script from a kickstart file when installing a custom distribution based on Centos. However, the behaviour ...
pxul's user avatar
  • 175
0 votes
1 answer
482 views

How to apply "set number" to vi on root?

I'm using vi on centos 6.5 and added "set number" script to /etc/bashrc in order to look line numbers whenever boot. It works well to show it on user login but not root. How to apply "set number" of ...
S.J. Lim's user avatar
  • 115
0 votes
2 answers
561 views

Empty /var/log after running cron bash script

I wrote a little bash script and all of a sudden my /var/log folder is completely empty except for the log I created for the bash script. This is the script I'm running every hour with cron: #!/bin/...
Ortix92's user avatar
  • 1,021
1 vote
1 answer
2k views

Associate MIME Type with Shell Script?

I want to associate any file type with a .abc extension with the following shell script: #!/bin/bash echo arg 1 is: $1 The .abc type files just have text, but I want to ensure that opening a file ...
user avatar
206 votes
11 answers
41k views

I accidentally typed password into bash command line

I accidentally typed my password into bash command line, mistaking the Last login: ... line for Wrong password (I was in a hurry). What do I do to cover my trace? What I did was editing .bash_history ...
MaDa's user avatar
  • 2,013

15 30 50 per page