shell

  1. F

    Solved How do I use the command “cut” to select the 2nd field in a string variable?

    I'm using FreeBSD version: 11.3-RELEASE-p14, Shell version: tcsh 6.20.00 (Astron) 2016-11-24 (x86_64-amd-FreeBSD) options wide, nls, dl,al, kan, sm, rh, color, filec and trying to use cut to harvest fields in a string variable, with no success. #! /bin/sh . # Variables filelength=0 start=0...
  2. T

    Shell sed: rename(): Not a directory

    Hi! Why does sed exaust "sed: rename(): Not a directory" called sed -i ~ 's/^\#\+\(PermitRootLogin\) .*$/\1 yes/g' /etc/ssh/sshd_config The manual states: -i extension Edit files in-place similarly to -I, but treat each file independently from other files. In...
  3. N

    Solved Shell Script IPC/RPC Messaging Between Different Hosts?

    I would like one of my hosts to broadcast occasional periodic signals to a shell script running on other host(s) on the same LAN. I'm currently reading about various IoT protocols, but I'm wondering what the more traditional approaches were for this kind of messaging. Ideally, I'd want some...
  4. quamenzullo

    Solved Correct syntax for the 'a' function of FreeBSD's sed?

    I'd liked to use the 'a' function of sed to append something after a given line in a file. For instance, I want to add "ListenAddress xx.xx.xxx.xxx" after the line that begins with "#ListenAddress" in a copy of sshd_config: Using sh I do: # IP=xx.xx.xxx.xxx # sed -E -i ""...
  5. I

    jails How do I "setenv PATH" in a jail, preferably using zsh?

    If I execute the command: setenv PATH "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin:/root/.cargo/bin" after going into the jail by "jexec 1", it would work. However, I'd like to make it sticky. I tried many ways but nothing works. Further, preferably, I'd like to do...
  6. S

    locale issues

    I'm trying to extract from a tarball. (I don’t need help with that.) But I get this nonsense: Pathname can’t be converted from UTF-8 to current locale When I enter the command locale the LANG= line is empty. Hoo boy Yup! everything that's easy in any version of linux is like being...
  7. StreetDancer

    FreeBSD 12.1 - Updated System & "su" root user no longer shows root@domain.tld; blank #

    FreeBSD 12.1 - Updated System & "su" root user no longer shows root@domain.tld; blank # I am not sure what happened or how to revert the changes that a system "pkg upgrade" did to my installation. I used to ssh in and get user@domain.tld ... then issue "su" and get "root@domain.tld" ; now it's...
  8. NapoleonWils0n

    editing audio and video with ffmpeg - scripts and youtube videos

    Hi I have written some shell scripts (bourne shell not bash) for basic video and audio editing tasks with ffmpeg A lot of the open source video editors dont really compare to Final Cut Pro or Davinci Resolve, and can be difficult to get hardware encoding working Thats why i decided to write...
  9. L

    Shell regexp and shell script changing url links to base64 in css files

    so this script can alter the url to data64 encoding by matching in css file background-image: url(afdsf.png). some contribute this: echo 'background-image: url("../images/doesntmatter/imgDoesNotMatter.png");' | sed -r 's,background-image\s*:\s*url\("(.+)"\);,\1,'...
  10. T

    Shell How to parse a text file?

    I am looking to parse a file for specific content that is on a line that always has a specific beginning, for example: "Program: code" I want to extract code on the line that starts with Program. I then want to add that extracted string into an already created file. Can anyone provide some...
  11. vermaden

    HOWTO: Ghost in the Shell - Part 4

    I would like to share HOWTO in Ghost in the Shell series about efficient working in the UNIX shell environment. Ghost in the Shell - Part 4 https://vermaden.wordpress.com/2019/03/15/ghost-in-the-shell-part-4/ Regards, vermaden
  12. V

    sh vi mode with command mode by default

    Hi! /bin/sh (Almquist shell) with vi mode (set -o vi) starts every new line at insert mode. So I must press Esc every new prompt if I want to go through history. Is it possible to start shell prompts with "vi command (normal) mode"?
  13. vermaden

    HOWTO: Ghost in the Shell - Part 3

    I would like to share HOWTO in Ghost in the Shell series about efficient working in the UNIX shell environment. Ghost in the Shell - Part 3 https://vermaden.wordpress.com/2018/09/15/ghost-in-the-shell-part-3/ Regards, vermaden
  14. takumi

    Image viewer for the console.

    Hi. I like to know, is there is a chance to see images, pdf, and videos on the console (no X running) with the framebuffer on FreeBSD like there is on my Gentoo with fbi, fbgs and mplayer. Looks like w3m (w3m-img) could show images, but is a project whit not update from a long time. Regards.
  15. vermaden

    HOWTO: Ghost in the Shell - Part 2

    I would like to share HOWTO in Ghost in the Shell series about efficient working in the UNIX shell environment. Ghost in the Shell - Part 2 https://vermaden.wordpress.com/2018/07/08/ghost-in-the-shell-part-2/
  16. Duffyx

    Shell Variables in a cron entry

    I'd like to define some local variables in a cron entry so that I can create the following file /usr/local/etc/cron.d/rsync with the following contents: PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin excludes="--exclude=/storage --exclude=/proc"...
  17. MaxRuse11

    Setting up TCSH

    I've got a Digital Ocean droplet running FreeBSD which I shell into. I can locate tcsh under /bin/tcsh but using setenv in my local .cshrc file doesn't cause this shell to be used on next login. Env reports the shell as sh and the prompt hasn't changed to > Editing master.passwd to use tcsh...
  18. ILUXA

    Shell Share your .zshrc file

    I like the way how tcsh works, but it is outdated a little bit (only 1 update since 2012), also some nice features are available in zsh, like suggesting flags and other completions for cli and not only cli apps… But some of its features are distracting and annoying IMHO. I didn't find any...
  19. A

    Solved Script not running from Cron

    Hello, I have that sh script: #!/bin/sh DATE=`date +%Y-%m-%d:%H:%M:%S` NAME="game" if ps ax | grep -v grep | grep $NAME > /dev/null then echo "$NAME service running, everything is fine" else echo "$DATE: Restarting $NAME" >> /root/log cd /usr/home/game/db && ./game fi and it works...
  20. JazzSinatra

    TTY, Shell, prompt, terminal?

    This is probably a noob question, but I have wondered for some time the difference between TTY and terminal like rxvt-unicode or Xterm (and less shell). Is TTY just a virtual device which runs terminal emulator like rxvt-unicode which runs shell like sh or bash? If I have a freshly installed...
Top