From: "henry.maestu@... (Henry Maestu) via ruby-core" Date: 2023-11-22T07:10:25+00:00 Subject: [ruby-core:115449] [Ruby master Bug#20014] Ruby command line exection ignores what inside of command {} Issue #20014 has been updated by henry.maestu@gmail.com (Henry Maestu). nobu (Nobuyoshi Nakada) wrote in #note-1: > The brace expansion is a feature of `sh`, and multiple arguments form `system` invokes the given command without `sh`. Thank you! Executing this in terminal acts same way as ruby. `sh -c 'df -h --exclude={tmpfs,devtmpfs,squashfs} --total'` This works for me `system("bash", "-c", "df -h --exclude={tmpfs,devtmpfs,squashfs} --total")` ---------------------------------------- Bug #20014: Ruby command line exection ignores what inside of command {} https://bugs.ruby-lang.org/issues/20014#change-105380 * Author: henry.maestu@gmail.com (Henry Maestu) * Status: Rejected * Priority: Normal * ruby -v: 2.3.0, 3.2.2 * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- Ruby command line executions ignore what inside of {} ``` ruby storage_info = `df -h --exclude={tmpfs,devtmpfs,squashfs} --total` puts storage_info # Same with System command. Seems everything inside {} is ignored r, w = IO.pipe system('df', '-h', '--exclude={tmpfs,devtmpfs,squashfs}','--total', out: w) w.close output = r.read puts output ``` Ruby outout: ``` Filesystem Size Used Avail Use% Mounted on udev 16G 0 16G 0% /dev tmpfs 3,2G 11M 3,2G 1% /run /dev/sdc2 212G 194G 6,4G 97% / tmpfs 16G 11M 16G 1% /dev/shm tmpfs 5,0M 4,0K 5,0M 1% /run/lock tmpfs 16G 0 16G 0% /sys/fs/cgroup /dev/loop1 64M 64M 0 100% /snap/core20/2015 /dev/loop2 64M 64M 0 100% /snap/core20/1974 /dev/loop4 82M 82M 0 100% /snap/gtk-common-themes/1534 /dev/loop0 148M 148M 0 100% /snap/figma-linux/169 /dev/loop5 165M 165M 0 100% /snap/gnome-3-28-1804/194 /dev/loop3 56M 56M 0 100% /snap/core18/2796 /dev/loop8 165M 165M 0 100% /snap/gnome-3-28-1804/198 /dev/loop10 148M 148M 0 100% /snap/figma-linux/178 /dev/loop7 425M 425M 0 100% /snap/kde-frameworks-5-qt-5-15-3-core20/8 /dev/loop9 497M 497M 0 100% /snap/gnome-42-2204/141 /dev/loop12 497M 497M 0 100% /snap/gnome-42-2204/132 /dev/loop11 106M 106M 0 100% /snap/core/16091 /dev/loop14 219M 219M 0 100% /snap/gnome-3-34-1804/93 tmpfs 16G 5,0M 16G 1% /tmp /dev/loop13 117M 117M 0 100% /snap/robo3t-snap/8 /dev/loop16 205M 205M 0 100% /snap/rpi-imager/465 /dev/sdc1 300M 5,9M 294M 2% /boot/efi /dev/loop15 74M 74M 0 100% /snap/core22/858 /dev/loop18 219M 219M 0 100% /snap/gnome-3-34-1804/90 /dev/loop6 168M 168M 0 100% /snap/postman/231 /dev/loop17 350M 350M 0 100% /snap/gnome-3-38-2004/143 /dev/loop19 350M 350M 0 100% /snap/gnome-3-38-2004/140 /dev/loop20 437M 437M 0 100% /snap/kde-frameworks-5-96-qt-5-15-5-core20/7 /dev/loop21 258M 258M 0 100% /snap/rubymine/81 /dev/loop23 116M 116M 0 100% /snap/bitcoin-core/145 /dev/loop22 167M 167M 0 100% /snap/spotify/70 /dev/loop24 205M 205M 0 100% /snap/rpi-imager/520 /dev/loop25 117M 117M 0 100% /snap/robo3t-snap/9 /dev/loop26 74M 74M 0 100% /snap/core22/864 /dev/loop28 128K 128K 0 100% /snap/bare/5 /dev/loop27 168M 168M 0 100% /snap/postman/234 /dev/loop29 92M 92M 0 100% /snap/gtk-common-themes/1535 /dev/loop30 159M 159M 0 100% /snap/spotify/68 /dev/loop31 106M 106M 0 100% /snap/core/16202 /dev/loop32 56M 56M 0 100% /snap/core18/2790 tmpfs 3,2G 80K 3,2G 1% /run/user/1000 total 287G 200G 76G 73% - ``` Example on terminal, expected output: ``` henry@development:~$ df -h --exclude={tmpfs,devtmpfs,squashfs} --total Filesystem Size Used Avail Use% Mounted on /dev/sdc2 212G 194G 6,4G 97% / /dev/sdc1 300M 5,9M 294M 2% /boot/efi total 212G 194G 6,7G 97% - ``` Have tested this on both 2.3.1 and 3.2.2 version on Ruby, same result, using Debian 10 -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/