Skip to main content

All Questions

Tagged with
0 votes
1 answer
82 views

How is this exec command supposed to work in this context?

I'm working through a textbook on UNIX system administration. Chapter 3 of "Unix Third Edition" by a Syed Mansoor. Chapter 13 has the following example of exec usage which is straightforward ...
Anthony De Vellis's user avatar
1 vote
1 answer
189 views

FreeBSD - get timezone in Continent/Region format

I have a Linux (bash) script to generate a login message (motd). One of the things it displays is the timezone, using the command timedatectl | grep Time | awk {'print $3'}. The command returns ...
PGEL's user avatar
  • 157
-2 votes
3 answers
277 views

How can I remove a character {only found between curly brackets}, and take the brackets along for the ride?

For example, if I'm removing only spaces between brackets, the title of this post would be: How can I remove a character onlyfoundbetweenbrackets, and take the brackets along for the ride? I've only ...
Joe's user avatar
  • 19
0 votes
2 answers
89 views

BASH I would like this if-then-else behaviour explained

I have this short if-then-else script: for INV in "$(ls np4178/*pdf)" ;\ do INVNUMB="$(pdfgrep -ho 'IN[0-9]{6,6}' $INV)" ; \ if [[ -z ${INVNUMB+x} ]]; \ then \ echo "\n$...
James B. Byrne's user avatar
0 votes
1 answer
1k views

for loop in FreeBSD (pfSense) doesn't work

I've just noticed that the same code for for loop in bash doesn't work in FreeBSD wolf@linux:~$ echo $SHELL /bin/bash wolf@linux:~$ wolf@linux:~$ for i in {1..3}; do echo $i; done 1 2 3 wolf@linux:~$...
Wolf's user avatar
  • 1,631
1 vote
1 answer
115 views

Getting a parameter from a config file in FreeBSD

I want to make a bash file that reads a parameter from a config file. In Debian based linux it works fine by: my.config: MYVARIABLE=12345 my.sh: #!/bin/bash source my.config echo $MYVARIABLE But I ...
Samto's user avatar
  • 13
2 votes
2 answers
129 views

How to include my virtual console ID in the prompt, in FreeBSD

When I use virtual consoles ALT-F<1~n> in FreeBSD, I want my 'zsh', 'sh' (and possibly other shells) startup scripts to include the virtual console number in the prompt, if it's not the default ...
Stilez's user avatar
  • 1,271
0 votes
0 answers
28 views

Get immediate folder of file using find (issue with spaces) [duplicate]

I'm trying to search my Movies folder to find the immediate folder of the .MKV file I'm searching for. The below works (echo 5) to save the immediate folder as a variable, BUT, it does not work if $...
eptesicus's user avatar
1 vote
1 answer
438 views

How to use globbing for loop in bash -c command?

I'm trying to run a for loop inside of bash -c so I can time it. This code writes 23 every time. How can I make it iterate through the numbers? time bash -c "for i in {0..23}; do echo $i & done"...
Elliott B's user avatar
  • 565
0 votes
1 answer
464 views

how to execute a bash script when someone connects to the ssh server (freebsd)

There is a freeBSD server that has a script on bash. The script analyzes the log file of ipfw (for unauthorized access to ssh) and in case of damage sends the message to the mail. Everything works if ...
Artem Khmil's user avatar
0 votes
1 answer
7k views

-bash: ./catalina.sh: No such file or directory

Using SSH, I want to execute catalina.sh to start a Tomcat server (from my client Mac terminal). I log in without any issue. Then, I do: [site /home/public]$ cd $CATALINA_HOME/bin and on Enter I ...
Life after Guest's user avatar
7 votes
2 answers
13k views

FreeBSD: How to set Bash as the default shell

I've used bash shell in all my Linuxes and in Mac OS X. I understand that tcsh is the default shell in FreeBSD. If I were to install bash, how would I make it my default shell?
Steve Wright's user avatar
1 vote
1 answer
546 views

tput command doesn't work in if statement

I'm trying to use the tput command in a bash script if statement but for some reason it's behaving unexpectedly. When running the command and then checking the exit code only in the if statement ...
Harry Muscle's user avatar
  • 2,547
3 votes
2 answers
5k views

Checking for root user in sh and bash [duplicate]

I am attempting to write a script that automates the installation of ports/packages on new FreeBSD installs. To do this, the user who executes the script must be root. The system is "supposed" to be ...
Allan's user avatar
  • 1,060
1 vote
1 answer
1k views

How to use "read -i" in FreeBSD? (prefilling users input)

I wrote a bash-script in CentOs, but now I have an issue with this script in FreeBSD. So the problem is in difference between "read" function in Linux and "read" function in FreeBSD. This is a part ...
rGA145's user avatar
  • 419

15 30 50 per page